I have a simple app in Swift with just a few views:
- A UIWebView
- some TableViews
- and another view with some data I download from my server
It all works well until when using the app I press the home button, leave there for a while then the iPad goes on sleep mode. A few days later I tap on the app icon and it won't start:
- first tap on the icon will select the icon (goes a little darker) and deselect it a few seconds later
- second tap will launch the LaunchScreen and crash a few seconds later
- double tap the home button and quit the app will sometimes work
I'm just wondering if there is something I need to set on my code to handle idle/long periods of inactivity in something like viewWillDisappear
or other methods?
If so I already have this in all my controllers:
override func viewWillDisappear(animated: Bool) {
timer.invalidate()
webView.removeFromSuperview()
}
Maybe I need to call super.
in there too? or something else I'm missing?
You probably have some null pointer exception and crash. Maybe you are calling some variable that is not set (and checked if not null). Try disabling app funcionality (like downloading, storing and using data from server) and see where you app starts working normal again and then procede from there.
Sorry for vague answer but withouth code and maybe some log it is really hard to give specific answer.
And NO, you dont have to do anything special to handle idle/long periods of inactivity.