Using GKPeerPickerController within a selector from a Cocos2D CCMenuItem
Posted
by Mark Hazlett
on Stack Overflow
See other posts from Stack Overflow
or by Mark Hazlett
Published on 2010-03-25T01:09:56Z
Indexed on
2010/03/25
1:13 UTC
Read the original article
Hit count: 423
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?
© Stack Overflow or respective owner