0

I want to send a resource with Multipeer Connectivity framework, see below. But the strange thing is that the log says:

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

Error: Peer not connected

So peer is connected, and in the next line says it is not connected. How, why? All the delegate methods are implemented well on client side.

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];

            }
        }];
    });
János
  • 32,867
  • 38
  • 193
  • 353
  • 1
    This may answer your question, seem like a bug on apple part see link [here](http://stackoverflow.com/questions/18935288/why-does-my-mcsession-peer-disconnect-randomly) – Shams Ahmed Mar 21 '14 at 11:54
  • Unless that's a typo you are passing the array of peers as the `toPeer:` argument when you should be passing an `MCPeerID` object. – ChrisH Mar 28 '14 at 15:59

0 Answers0