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