readium / SDKLauncher-iOS

A small iOS application to serve as a launcher/testbed for the Readium SDK.
BSD 3-Clause "New" or "Revised" License
71 stars 47 forks source link

Cocoa server doesn't accept connections after a lock screen #81

Closed olivierkorner closed 8 years ago

olivierkorner commented 8 years ago

After the application has gone to background as a result of the activation of the lock screen or because the user has made another application active, when the application enters foreground again, the Cocoa HTTP server doesn't accept connections any more. If the user then tries to go to the next or previous page, the webview only displays a blank screen.

The behavior is documented here: https://github.com/robbiehanson/CocoaHTTPServer/issues/10

The application needs to observe UIApplicationWillResignActiveNotification and UIApplicationWillEnterForegroundNotification notifications, and stop and restart the server accordingly.

It is also important to preserve the initial server port, as the webview won't be able to load resources from a different port.

rkwright commented 8 years ago

Nice catch, Olivier. Thanks

danielweck commented 8 years ago

"The application needs to observe UIApplicationWillResignActiveNotification and UIApplicationWillEnterForegroundNotification notifications, and stop and restart the server accordingly.

It is also important to preserve the initial server port, as the webview won't be able to load resources from a different port."

Great find, but I wonder why this issue had not surfaced before? @bluefirepatrick @jdempcy Bluefire folks, surely this is a scenario that you handle properly already?