I have the following scenario:
WaitingVC). The MCNearbyServiceAdvertiser object is initialized at application start, and the advertising starts (startAdvertisingPeer) when the WaitingVC is presented.MCNearbyServiceBrowser up and running, also with custom UI (that is, not using the Apple provided MCBrowserViewController).browser:foundPeer:withDiscoveryInfo: is called).WaitingVC. Advertising is stopped (stopAdvertisingPeer).browser:lostPeer: is called).The crash happens in queue com.apple.NSNetServices.tcplistener-queue. A dispatch_call_block_and_release call fails at release (EXC_BREAKPOINT).
I truly wonder, if this a bug in the MC framework; or am I missing some cleanup procedure? Peer A only does the following:
MCPeerID, store in a strong property,MCNearbyServiceAdvertiser, store in a strong property, setting delegate,WaitingVC: calling startAdvertisingPeer, then calling stopAdvertisingPeer when done.The crash seemingly occurs no matter what I do. If the MCNearbyServiceAdvertiser object and the MCPeerID object is being kept in WaitingVC and thus destroyed after the WaitingVC is closed, the crash still happens.
Apart from this, everything works fine (invitation procedure, connecting, exchanging data); but this few seconds window for certain failure is not really acceptable. Keeping the advertiser running all the time solves this, but it's just treating the symtpom (and this "sync" feature would be used seldom in the applicaiton, so it's also an overkill).
Update:
The same crash happens when using MCAdvertiserAssistant, if I call its stop method on Peer A, and quickly connect on Peer B. Also, I tested the scenario on this tutorial: http://techmaster.vn/2013/09/multipeer-connectivity-quick-tutorial/ - and the result is the same: Crash. So I have a strong suspicion, this is a bug on Apple's side...
I've been experiencing the same crash and according to this thread in the Dev Forums so have other people. A bug report has been created for it:
Developer Forums: Multipeer Connectivity Crash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With