3

I want to use the new iOS 7 Multipeer Connectivity in my app where one person is a host, and anyone can join the host.

I have successfully implemented it using a combination of this tutorial and the Apple Developer Reference to Multipeer Connectivity.

What I want to do however, is add an extra layer of security so not just everyone can join the app. I want it so when a person requests to join the host, they must enter a random 4 digit pin code which the host will tell the group so people who know it can type it in and join the session.

Is this possible to do? As iOS 7 is so new, it is hard to find andy information on it.

Any help or suggestions would be much appreciated. Cheers

falky
  • 589
  • 2
  • 11
  • 27

1 Answers1

6

This absolutely is possible to do. When you invite your peer to connect to the service, you can send an NSData object to the advertiser. Just convert the pin code to an NSData object and send it to be checked on the advertising device.

You can find the relevant info on Apple's documentation site, with the context variable. Let me know if you need more guidance.

- (void)invitePeer:(MCPeerID *)peer
         toSession:(MCSession *)session
       withContext:(NSData *)context
           timeout:(NSTimeInterval)timeout
Community
  • 1
  • 1
Jeremy White
  • 2,818
  • 6
  • 38
  • 74
  • Hi Jeremy. Thanks very much for the response! I did discover that in my research. I have tried to implement it using the WWDC multipeer connectivity video. My code is: – falky Oct 21 '13 at 05:08
  • Hi Jeremy. Thanks very much for the response! I did discover that in my research. I have tried to implement it using the WWDC multipeer connectivity video. My code and full question are here: http://stackoverflow.com/questions/19486762/sending-and-receiving-an-invitation-with-multipeer-connectivity You obviously seem to have a pretty good grasp of the whole framework so some help would be much appreciated! Thanks :) – falky Oct 21 '13 at 05:21