iPhone app not reloading data after reopening
I am new to objective-c and iPhone app development. Currently I've been faced with a problem that I'm not sure how to fix. The problem is that I want my a开发者_运维技巧pp to completely close and release all data when the user presses the home button and then when the user reopens the app it refreshes the data from my online server. I am currently testing on the iPhone simulator and it seems that when the user reopens the program it reopens the old state and does not call the viewDidLoad
method to refresh the data nor it calls the -(void)applicationWillTerminate:(UIApplication *)application
when the user presses the home button.
Any suggestions??
That's probably because it just got suspended (multitasking).
You can either disable multitasking in the plist file:
set UIApplicationExitsOnSuspend
to NO/false
(unchecked)
This disables multitasking completely. Or you can implement the new app delegates that get called on resuming and reload your data there:
- (void)applicationWillEnterForeground:(UIApplication *)application
精彩评论