Connect browser and advertiser without displaying warning message in Multipeer connection

I am currently studying the structure of the interconnect. I have 2 options in the advertiser and application browser.

Therefore, when a user launches a browser on one device and an advertiser on another, they should be able to find each other. When the device appears in the browser and the user clicks on it, the user with the advertising device will be presented with a warning allowing them to choose whether this connection will be.

But I want the browser, by clicking on a specific advertiser, to automatically establish a connection without warning.

Note: - I am currently using MCBrowserViewController and MCAdvertiserAssistant

So can this be done? Can anyone do this?

+3
ios objective-c multipeer-connectivity
source share
1 answer

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); 
+3
source share

All Articles