I hope I do not violate the NDA by posting this question.
I use the new connectivity option with many types to send some files via bluetooth to neighboring devices. I managed to send invitations, but it doesn't seem to me like to display a UIAlertView where the user can accept or decline the invitation. Right now, when the user submits, the file is automatically saved and there is no acceptance / rejection warning.
The code:
- (void) advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept, MCSession *session))invitationHandler{ ... save the data context
but with a warning:
- (void) advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void(^)(BOOL accept, MCSession *session))invitationHandler{ DevicePeer = [MCPeerID alloc]; DevicePeer = peerID; ArrayInvitationHandler = [NSArray arrayWithObject:[invitationHandler copy]];
and alert viewing method:
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
When the user presses YES, the application crashes and I get an error message:
[__NSMallocBlock__ nearbyConnectionDataForPeer:withCompletionHandler:]: unrecognized selector sent to instance 0x14d4e3b0'
I looked at the iOS developer library and there is no such method except
- (void)nearbyConnectionDataForPeer:(id)arg1 withCompletionHandler:(id)arg2{ }
which does not work. No information on iOS developer forums. Any ideas?
ios multipeer-connectivity
Alessandro
source share