The Multipleer Connectivity framework provides additional APIs that support software discovery and customize the experience beyond the scope provided by MCBrowserViewController and MCAdvertiserAssitant.
Thus, you can immediately send an invitation without waiting for user interaction.
MCNearbyServiceBrowser and MCNearbyServiceAdvertiser provide methods for handling software openings for the browser and advertiser, respectively. The MCNearbyServiceBrowserDelegate protocol supports your custom browser, allowing you to respond to searches for nearby devices, while MCNearbyServiceAdvertiserDelegate allows you to programmatically handle browser prompts.
You need to make a heavy lift in your code to create a browser user interface, be present near devices and initiate invitations for peers. At the end of the advertiser, the user interface includes presenting an invitation to the user, receiving a response from users, and calling a handler to transmit the user's response to the browser.
However, once peers are connected, sending data works exactly the same as before.
To learn how to configure these NSHipster checks for some additional code examples at this link . It uses a UIActionSheet, but you can just accept the invitation at the advertiser: didReceiveInvitationFromPeer: withContext: inviteHandler :.
invitationHandler(YES, self.session);
jamdaddy25
source share