You can connect with a peer without showing a browser by using the MCNearbyServiceBrowser, as it has no associated UI.
One peer starts browsing like this:
self.thisPeer = [[MCPeerID alloc] initWithDisplayName:@"Peer Name"];
self.session = [[MCSession alloc] initWithPeer:self.thisPeer ];
self.session.delegate = self;
self.serviceBrowser = [[MCNearbyServiceBrowser alloc] initWithPeer:self.thisPeer serviceType:<lowercase 1-15 chars>
self.serviceBrowser.delegate = self;
[self.serviceBrowser startBrowsingForPeers];
The other peer starts advertising like this:
MCPeerID *peerID = [[MCPeerID alloc] initWithDisplayName:@"some name"];
self.session = [[MCSession alloc] initWithPeer:peerID];
self.session.delegate = self;
self.advertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:peerID discoveryInfo:nil serviceType:<lowercase 1-15 chars>];
self.advertiser.delegate = self;
[self.advertiser startAdvertisingPeer];
Then, when the browsing peer hears the nearby advertising peer, it sends an invite to join a session:
- (void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID withDiscoveryInfo:(NSDictionary *)info {
NSLog(@"Found a nearby advertising peer %@", peerID);
[self.serviceBrowser invitePeer:peerID toSession:self.session withContext:nil timeout:60];
}
On receipt of the invite, you can show an accept/decline alert if you want to or you can simply accept the invitation.