Using GKPeerPickerController within a selector from a Cocos2D CCMenuItem
- by Mark Hazlett
Hey everyone,
So i'm trying to use GameKit along with Cocos2D so that when a user clicks on the multiplayer menu item it will display the GKPeerPickerController. I'm however, running into some snags. It doesn't seem to want to compile. However, it doesn't give me an error inside of the code that's in my selector. Anyways here's the code...
@implementation GameOverLayer
- (id) init
{
self = [super init];
if (self != nil)
{
[CCMenuItemFont setFontSize:20];
[CCMenuItemFont setFontName:@"Helvetica"];
CCMenuItem *start = [CCMenuItemFont itemFromString:@"Play Again!" target:self selector:@selector(startGame:)];
CCMenuItem *connect = [CCMenuItemFont itemFromString:@"Multiplayer" target:self selector:@selector(connect:)];
CCMenu *menu = [CCMenu menuWithItems:start,connect, nil];
[menu alignItemsVertically];
[self addChild:menu];
}
return self;
}
-(void)startGame: (id)sender
{
[[CCDirector sharedDirector] replaceScene: [HelloWorld scene]];
}
-(void)connect: (id)sender
{
GKPeerPickerController *peerPicker;
peerPicker = [[GKPeerPickerController alloc] init];
peerPicker.delegate = self;
peerPicker.connectionTypesMask = GKPeerPickerConnectionTypeOnline | GKPeerPickerConnectionTypeNearby;
[peerPicker show];
}
@end
The error message i'm getting is...
".obj_class_name_GKPeerPickerController", referenced from:
Literal-Pointer@_OBJC@_cls_refs@GKPeerPickerController in GameOverScene.o
Symbol(s) not found
Collect2: id returned 1 exit status
Any ideas?