Multipeer Connectivity:connectedPeer未连接?

时间:2014-03-21 11:19:30

标签: ios multipeer-connectivity

我想发送一个带有Multipeer Connectivity框架的资源,见下文。但奇怪的是日志说:

[self.mySession connectedPeers]: (
    "<MCPeerID: 0x10fc9d60 DisplayName = iPad>"
)

Error: Peer not connected

所以对等体是连接的,并且在下一行表示它没有连接。怎么样,为什么?所有委托方法都在客户端很好地实现。

dispatch_async(dispatch_get_main_queue(), ^{
        NSLog(@"[self.mySession connectedPeers]: %@", [self.mySession connectedPeers]);
        [self.mySession sendResourceAtURL:u withName:@"apple" toPeer:[self.mySession connectedPeers] withCompletionHandler:^(NSError *error) {
            if (error) {
                NSLog(@"Error: %@", [error localizedDescription]);
            }

            else{
                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MCDemo"
                                                                message:@"File was successfully sent."
                                                               delegate:self
                                                      cancelButtonTitle:nil
                                                      otherButtonTitles:@"Great!", nil];

                [alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];

            }
        }];
    });

0 个答案:

没有答案