Usefulness of applicationDidEnterBackground for saving app data
Are applicationDidEnterBackground
and related methods very useful? I know the meaning of these methods from reading Apple's guides, but I don't have a iPhone, and I don't know if is it common that an application in the background will be closed by the syste开发者_JAVA技巧m.
In particular, I have a utility program that takes three to four strings of input from user, then takes a very small XML file from the Web, and prints a result. There's no sense in saving these data, right?
Thanks for any help.
I would think about the user experience. If the app is closed by the system, would it be difficult or even more importantly just plain annoying for the user to reenter the values on the screen again? It's small things like saving user input on close that make the user experience better.
Of course if the entry is temporal, and they return 5 days later to the app, it might not make sense to show the old stale data.
Think about your user and what would make the most sense to them.
Just to add to Ryan's answer, if it doesn't make sense to save state on your application, you could just treat every launch as a fresh launch by setting UIApplicationExitsOnSuspend
to 1
in your info.plist
file.
精彩评论