views:

3586

answers:

1

I keep getting this message (in the title). Just take a quick look at my code if you want to see what I'm doing. I've just started implementing the Peer Picker, so I'm not completely done yet. I just need some advice/help in the first part. The error shows up in the .m file between the two #import statements, which means it has to be some wrong way that I've used the GKPeerPickerController in the header file.

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
+1  A: 

Hi

Have you included this statement in the header file?

#import <GameKit/GameKit.h>

Also you need to include the GameKit framework.

lostInTransit