简体   繁体   English

GKSession调用是否阻塞了主线程?

[英]Are GKSession calls blocking the main thread?

I read in Technical Note TN2277 that it is important to close all sorts of network sockets whatsoever when the app goes to background. 我在技术说明TN2277中读到 ,当应用程序进入后台时,关闭所有类型的网络套接字很重要。 This most likely also includes GKSession. 这很可能还包括GKSession。

They say an expiration handler is required when going to background, and that it is important that the networking code if it has to say "goodbye" to other peers must be called asynchronously. 他们说,进入后台时需要使用过期处理程序,并且必须异步调用联网代码(如果必须向其他对等设备说再见)是很重要的。

So is GKSession sendData method asynchronous or is it blocking? 那么GKSession sendData方法是异步的还是阻塞的?

There definitely appears to be a problem with GKSession blocking the main thread in certain circumstances in iOS 6. At the moment, we cannot move our pool of iPads to iOS 6 because our enterprise GKSession networking app experiences these blocking issues (but not in iOS 5 or earlier). 在某些情况下,iOS 6中GKSession阻塞主线程肯定存在问题。目前,我们无法将iPads池移至iOS 6,因为我们的企业GKSession联网应用遇到了这些阻塞问题(但在iOS 5中没有)或更早的版本)。 For example, sending a file to more than 4 iPads at the same time from the server iPad leads to blocking behaviour. 例如,从服务器iPad同时将文件发送到4个以上的iPad会导致行为受阻。 In iOS 5 we can send the file to up to 15 connected clients simultaneously without problem. 在iOS 5中,我们可以同时将文件发送到最多15个已连接的客户端,而不会出现问题。

Also, our initial testing showed that using a mix of iOS 5 and 6 devices if the iOS 6 device connected after an iOS 5 device then the iOS 6 device would experience a lock up of the main thread. 此外,我们的初始测试表明,如果将iOS 6设备连接到iOS 5设备之后,则混合使用iOS 5和6设备,则iOS 6设备将遇到主线程锁定的情况。

I have posted an incident report with the iOS Dev Center but have heard nothing back... 我已经在iOS开发中心发布了事件报告,但什么也没听到。

UPDATE 30th Nov: I have now heard back from Apple and they are treating it as a bug in GameKit in iOS 6 and are investigating. 11月30日更新:我现在收到苹果的回音,他们将其视为iOS 6中GameKit中的错误,并正在调查中。 If you are also experiencing GKSession blocking issues in iOS 6 (but not iOS 5 or earlier) then you should report it as a bug. 如果您还在iOS 6(但不是iOS 5或更早版本)中也遇到GKSession阻止问题,则应将其报告为错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM