Multipeer Connectivity crash when inviting peer that stopped advertising

半腔热情 提交于 2019-12-04 13:10:57

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

This looks like a problem with your delegate callback

advertiser:didReceiveInvitationFromPeer:withContext:invitationHandler:

most likely with the final argument, the invitationHandler block. Is this method being called? When B makes A crash, there must be something that is being called and this seems to be the only conceivable entry point.

I found a simple workaround. I added a delay before starting the browser going.

To fill in the whole story I created a wrapper to replace GKSession with MCSession. The connection was being closed and reopened under specific circumstances, by both ends at the same time, hence it crashed. Adding a delay to the browser start offset it from the tear down of the other end avoiding the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!