objective c - iOS Multipeer Connectivity didReceiveInvitationFromPeer did not -


I know that this question has been asked many times, but after reading them many times more, I just do not get me Maltiipr connectivity to work "I'm not, I'm sending invitations but here's the code:

  @implementation MPCManager - (ID ) Init {self = [super init]; If (self) {_myPeerID = zero; _session = zero; _browser = zero; _advertiser = Zero; } Healthy return; } - (void) automaticBrowseAndAdvertiseWithName: (NSString *) DISPLAYNAME {_myPeerID = [[MCPeerID alloc] initWithDisplayName: DISPLAYNAME]; _session = [[MCAs Alloc] Init WithPair: _MairID]; _session.delegate = self; _advertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer: _myPeerID search info: zero service type: @ "trm -s"]; _advertiser.delegate = self; [_advertiser start ad viewer]; _browser = [[[MCNairBisvibIabersAlok] initWithPeer: _myPeerID serviceType: @ "trm -s"]; _browser.delegate = self; [_browner startbrowsingforars]; } - (void) session: (MCSession *) session didReceiveCertificate: (NSArray *) certificate fromPeer: (MCPeerID *) PEERID certificateHandler: (void (^) (BOOL accept)) certificateHandler {certificateHandler (yes); } - (void) Advertiser: (MCNearbyServiceAdvertiser *) Advertiser didReceiveInvitationFromPeer: (MCPeerID *) PEERID withContext: (NSData *) Reference invitationHandler: (void (^) (bool, MCSession *)) can not find it invitationHandler {NSLog (@ " Is called "); } - (void) browser (MCNearbyServiceBrowser *) browser Nenotstart Brajingforpr: (Ansiarar *) error {Anselog (@ "% @", [error localized description]); } - (void) browser: (MCNearbyServiceBrowser *) browser foundPeer: (MCPeerID *) PEERID withDiscoveryInfo: (NSDictionary *) info {NSLog (@ "This is called"); } - (zero) Inviter: (MCPeerID *) PERID {NSLog (@ "This is saying"); [_browser invitePeer: peerID for session: _seession withContext: zero timeout: 30]; }  

I'm running it on two simulators, and it was working for a while, but stopped suddenly, to see for the problem how or where to idea?

"itemprop =" text ">

Make sure that you are serializing and reusing your MCPeerID objects whenever possible every time When you call - (instancetype) initWithDisplayName: (NSString *) myDisplayName this gives a unique example

What often happens in a Dev environment that you reach with a flood . Advertisers and browsers and a ton of ghost duplicates in Bonjore advertising space can help you win everything.

If you are using simulators, they can help resetting them. On hardware you can restart or toggle airplane mode.

Take a look at the multipaker named "Networking with Cross-Platform". There are some good best practices to follow that will help a lot.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -