ios - PeerID object received by another peer is different that the original object in MultipeerConnectivity Framework -


I am using Multipoint Connectivity Framework I am saving my coworker to reuse it in NSUserDefaults ( As suggested by the apple) in this way (the following code is faster but there is behavior similar to Objective C):

  var peerId: MCPeerID = {omitted = NSUserDefaults.standardUserDefaults () ; Datatosno = Default Dataforaki ("KPIRID"); Var peer = NSKeyedUnarchiver.unarchiveObjectWithData (dataToShow) as? MCPeerID; If colleague == blue {peer = MCPIRID (display name: uidive courant device).); Give data: NSDT = NKAd Carrier Archived datahop object (peer); Defaults.setObject (data, forKey: "kPeerID"); Defaults.synchronize (); } Println ("I'm a colleague: \ (peer!)"); Return peer!! } ()   

I send an invitation to the search peer like this:

  the flash browser (Browser: mcnarbiswrez browser !, found peer pirid: mcpair id! , DiscoveryInfo information with: [NSObject: AnyObject]!) {Println ("\ (self.peerId) found peer (pearID)"); If the browser session = self.session {browserSession.delegate = self; Browser.invitePeer (PRIID, op: browser, contact, zero, timeout: 30); } Other {println ("browser session is zero"); }}   

Advertiser uses the code:

  func advertiser (Advertiser: MCNERB Service Provider !, Powered By: PieredID: MCPARID !, Contact With context: NSDTa !, InvitationHandler: ((Bull, MC session!) -> Zero)!) {Println ("Receive invitation from (self .PirID)"); Var session = available session (); InvitationHandler (true, session); }   

The problem I am facing is: When the advertiser gets a PIRID, it shows a different peer id than the original PIARID, but its correct display name is .

The browser console output is:

  I'm a colleague: & lt; MCPeerID: 0x1663e670 DisplayName = John Yang 'iPad & gt; & Lt; MCPeerID: 0x1663e670 DisplayName = John Yang 'iPad & gt; & Lt; Invitation from MCPeerID: 0x1666 DAF 0 DisplayNenam = John Yang's iPadMoney & gt; & Lt; MCPeerID: 0x1663e670 DisplayName = John Yang 'iPad & gt; & Lt; Connecting to MCPeerID: 0x1666 DAF 0 DisplayName = John Yang's iPad Day & gt; & Lt; MCPeerID: 0x1663e670 DisplayName = John Yang 'iPad & gt; & Lt; Connected to MCPeerID: 0x1666 DAF 0 DisplayName = John Yang's iPadMoney & gt;   

And the advertiser console output is:

  I'm a colleague: & lt; MCPeerID: 0x1569d230 DisplayName = John Yang's iPad Day & gt; & Lt; MCPERID: 0x1569d230 displayname = John Yang's iPadMoney & gt; Got colleague & lt; MCPeerID: 0x15586600 DisplayName = John Yang 'iPad & gt; & Lt; MCPERID: 0x1569d230 displayname = John Yang's iPadMoney & gt; & Lt; Connecting to MCPeerID: 0x15586600 DisplayName = iPad of John Yang & gt; & Lt; MCPERID: 0x1569d230 displayname = John Yang's iPadMoney & gt; & Lt; Connected to MCPeerID: 0x15586600 DisplayName = John Yang 'iPad & gt;   

As you can see, the browser and advertiser have their peerId information, when they are received by other colleagues, then their colleagues are different, can anyone explain this? Is there something that I am doing wrong?

  & lt; MCPeerID: 0x1663e670 display name = John Yang's iPad & gt;   

0x1663e670 indicates the memory address of the MCPeerID object on the current device. Do not reference the frame with the actual MCPeerID object, as long as it is expected to be displayName , it is the right colleague.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -