我正在使用以下代码来实例化视图 SenderPlayerViewController 并传递对象“会话”:
- (void)session:(GKSession *)session peer:(NSString *)peerID didChangeState: GKPeerConnectionState)state {
switch (state) {
case GKPeerStateConnected:
NSLog(@"Connected Central");
if ([settings.playerType isEqualToString:@"SENDER"]){
SenderPlayerViewController *myViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:NULL] instantiateViewControllerWithIdentifier:@"SenderPlayerViewController"];
[self.navigationController pushViewController:myViewController animated:YES];
myViewController.currentSession=session;
}
break;
case GKPeerStateDisconnected:
NSLog(@"Disconnected Central");
self.currentSession = nil;
break;
}
}
视图 SenderPlayerViewController 的头文件是:
@interface CentralViewController : UIViewController {
Settings *settings;}
@property (nonatomic, copy) GKSession *currentSession;
@end
执行代码时,我收到以下错误:
[GKSession copyWithZone:]: unrecognized selector sent to instance 0x9661200
在这里需要更多帮助....