8

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.

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.

Is there something changed in sdk 5.0 case this problem?

Regards.

3 Answers 3

8

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.

2
  • Yes, I think it is. Now I have to keep the screen unsleep while the app running.
    – Rico
    Nov 7, 2011 at 1:17
  • Try implementing the beginBackgroundTaskWithExpirationHandler of UIApplication. This should give your app time to run in the background when the sleep/wake button sleeps the device.
    – Steve M
    Nov 10, 2011 at 12:19
1

Do you have UIRequiresPersistentWiFi specified in your info.plist file? The time it takes iOS to shut down WiFi without this setting may have changed between iOS 4.x and 5.0.

1
  • 1
    I used it, but still not working. I don't know whether it is my problem because I google nothing about this.
    – Rico
    Oct 24, 2011 at 3:25
1

When you lock your iphone or ipad, all the network activities are stopped. Wifi connections are dropped. With what Robin has stated, this would work if the ipad is in idle state and not locked. Since there would be no traffic incoming or outgoing, iPad might decide to drop connection to WiFi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.