GKPeerPickerController

GKPeerPickerController

我正在使用GKPeerPickerController,这是我的简单代码:

- (IBAction)turnOn:(id)sender {
    GKPeerPickerController *peerpicker = [[GKPeerPickerController alloc]init];
    peerpicker.delegate = self;
    peerpicker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
    [peerpicker show];
}

-(GKSession*)peerPickerController:(GKPeerPickerController *)picker sessionForConnectionType:(GKPeerPickerConnectionType)type
{
    [picker dismiss];
    NSLog(@"picker Dismissed");
    return nil;
}

turnOn是​​从按钮触发的IBAction。问题是在取消选择器后,应用程序崩溃并显示EXC_BAD_ACCESS错误,为什么?我该如何解决?
这是从控制台:
2013-06-01 14:28:57.659 iShare[829:907] BTM: attaching to BTServer
2013-06-01 14:29:00.873 iShare[829:907] BTM: local device power state changed
2013-06-01 14:29:00.876 iShare[829:907] BTM: power is now on
2013-06-01 14:29:00.883 iShare[829:907] picker Dismissed

我的iPhone 3GS越狱了,这有问题吗?
谢谢!!

最佳答案

您正在从sessionForConnection中取消选择器,这是一个不寻常的选择,但是调用[self dismissModalViewControllerAnimated:YES];而不是[picker dismiss]应该更适合您。

10-07 19:13