我不断收到此消息(在标题)。如果你想看到我在做什么只要我们快速浏览一下我的代码。我刚刚开始实施的同行选择器,所以我还没有完全完成。我只需要在第一部分中的一些建议/帮助。误差在两个#进口语句之间的.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