Closed olivierkorner closed 8 years ago
Nice catch, Olivier. Thanks
"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?
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.