简体   繁体   中英

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. This most likely also includes 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?

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). For example, sending a file to more than 4 iPads at the same time from the server iPad leads to blocking behaviour. In iOS 5 we can send the file to up to 15 connected clients simultaneously without problem.

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.

I have posted an incident report with the iOS Dev Center but have heard nothing back...

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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