使用新的ios sdk 5.0进行屏幕锁定后iphone app网络连接断开连接 [英] iphone app network connection disconnect after screen locking with new ios sdk 5.0
问题描述
我的应用程序使用sdk 4.3就好了,但当我更改为sdk 5.0时,每次屏幕锁定时,只需几秒钟,tcp连接就会断开连接。
My app working with sdk 4.3 just fine, but when i change to sdk 5.0, every time the screen is locking, after just a few seconds, the tcp connection will disconnect.
我使用xmppframework,它给我一个错误,如
I use xmppframework, and it gives me an error like
"Error Domain=NSPOSIXErrorDomain Code=57 The operation couldn’t be completed. Socket is not connected"
看来套接字在屏幕锁定后关闭了。
It seems that the socket was been closed after screen locking.
sdk 5.0中有什么变化这个问题吗?
Is there something changed in sdk 5.0 case this problem?
问候。
推荐答案
在iOS 4.x中,当用户启动锁定屏幕时,应用程序继续在后台运行。现在在iOS 5.0中,当锁定屏幕启动时,应用程序将被发送到后台,您只能执行应用程序在后台可以执行的操作。因此,如果您没有做出其他安排,那么您的应用程序将丢失网络连接。
In iOS 4.x when the user initiated the lock screen the app continued to run in the background. Now in iOS 5.0 when the lock screen is initiated the app is sent to the background and you can only do what an app can do in the background. So if you have not made other arrangements than your app will loose network connections.
这篇关于使用新的ios sdk 5.0进行屏幕锁定后iphone app网络连接断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!