2009-06-26 63 views
0

之前的預期說明符 - 限定符列表我一直收到此消息(標題中)。如果你想看看我在做什麼,只要快速瀏覽我的代碼。我剛開始實施Peer Picker,所以我還沒有完全完成。第一部分我只需要一些建議/幫助。這個錯誤顯示在兩個#import語句之間的.m文件中,這意味着它必須是我在頭文件中使用GKPeerPickerController的一些錯誤方式。錯誤:在'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 

回答

3

你有沒有包含在頭文件這種說法?

#import <GameKit/GameKit.h> 

此外您還需要包含GameKit框架。