Search code examples
iosiphonexcodewebipad

Restart ios app after Ipad Locks/Shuts off


I've searched for hours on this so perhaps I am searching for the wrong terminology. but I have an ios web app that I created and I'm just wondering if there is anyway to force the app to restart/reload any time that the Ipad locks or is shut off?


Solution

  • force the app to restart

    no, you can't do that, it's not allowed, alternative you can exit your app(also not allowed)

    reload any time that the Ipad locks or is shut off?

    since you are developing a web app, you can reload the web page(not the whole app) by webView.reload(), if the webView doesn't refresh, see this.

    when the device is locked, func applicationWillResignActive(_ application: UIApplication) will be called, notice, not only locked, but also background, phone call or sms message and so on. so if you only care about the 'Lock' event, see this