3 ms·
Prior to true multitasking on iOS, Apple would tell you to tag view controllers for preservation so that when your app launches, the OS will restore the origina
by kccqzy 1y ago
Prior to true multitasking on iOS, Apple would tell you to tag view controllers for preservation so that when your app launches, the OS will restore the original view controllers, as if the app has been running the whole time. Old documentation here: https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html https://developer.apple.com/library/archive/featuredarticles...
(These days few apps bother to do this anymore. I switch away from an app in a minute and upon switching back I'm back at the app's home screen.)
- mayoff 1y agoThe state preservation API wasn't added until iOS 6.0 in 2012. https://developer.apple.com/documentation/uikit/uiviewcontroller/restorationidentifier https://developer.apple.com/documentation/uikit/uiviewcontro...
- kccqzy 1y agoThat's just an improved API introduced in iOS 6.0. Here's another earlier API that's available since iOS 2.0: https://developer.apple.com/documentation/uikit/uiviewcontrollerrestoration/viewcontroller(withrestorationidentifierpath:coder:)?language=objc https://developer.apple.com/documentation/uikit/uiviewcontro...
- jerf 1y agow.r.t. few apps caring about state, I recently upgraded my phone, which I had been using for a while and did not realize was a 2021 model, basically solely because at 4GB of RAM, I was getting to the point that I couldn't switch between any two apps without them all totally restarting on every switch because I was out of RAM all the time. I was also just starting to notice the battery was going but I could have managed that for a while yet... I really upgraded just for the RAM. (Also I had to reset the built-in camera to factory state and tell it to stop updating, because it couldn't even start with my phone's RAM anymore. Weird thing is I can't tell you what it was doing any better than the stock factory version.) But on, ahem, a "real" phone, it is nice to just assume that either I'm still swapped in, or the user doesn't care anymore. It's not quite 100% accurate, but it's pretty close, and low-effort for the app developer who doesn't have to be guessing any more about what state is and is not important.