문제

이 메시지를 계속받습니다 (제목). 내가하고있는 일을보고 싶다면 내 코드를 간단히 살펴보십시오. 방금 피어 피커를 구현하기 시작 했으므로 아직 완전히 끝나지 않았습니다. 첫 번째 부분에서 조언/도움이 필요합니다. 오류는 두 개의 #import 문의 .m 파일에 나타납니다. 즉, 헤더 파일에서 gkpeerpickercontroller를 사용한 잘못된 방법이어야합니다.

bluetooth_ad_hoc_networkappdelegate.h

#import <UIKit/UIKit.h>

@class Bluetooth_Ad_Hoc_NetworkViewController;

@interface Bluetooth_Ad_Hoc_NetworkAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    Bluetooth_Ad_Hoc_NetworkViewController *viewController;

    GKPeerPickerController *picker;
    GKSession *session;
    IBOutlet UILabel *status;
    NSData *data;
}

@property(nonatomic, retain)IBOutlet UILabel *status;
@property(nonatomic, retain)GKPeerPickerController *picker;
@property(nonatomic, retain)GKSession *session;
@property(nonatomic, retain)IBOutlet UIWindow *window;
@property(nonatomic, retain)IBOutlet Bluetooth_Ad_Hoc_NetworkViewController *viewController;


@end

bluetooth_ad_hoc_networkappdelegate.m

#import "Bluetooth_Ad_Hoc_NetworkAppDelegate.h"
#import "Bluetooth_Ad_Hoc_NetworkViewController.h"

@implementation Bluetooth_Ad_Hoc_NetworkAppDelegate

@synthesize status;
@synthesize picker;
@synthesize session;
@synthesize window;
@synthesize viewController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    // Override point for customization after app launch    
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

    // allocate and initialize data
    data = [[NSData alloc] initWithBytes:&status length:sizeof(status)];

    // Allocate and setup peer picker controller
    picker = [[GKPeerPickerController alloc] init];
    picker.delegate = self;
    picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
    [picker show];

}


- (void)dealloc {
    [status release];
    [viewController release];
    [window release];
    [super dealloc];
}


@end
도움이 되었습니까?

해결책

헤더 파일 에이 문을 포함 시켰습니까?

#import <GameKit/GameKit.h>

또한 GameKit 프레임 워크를 포함해야합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top