Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
I am closing in on the end of my app for my traveler show www.syvtraveler.com

I have noticed that when I closes the app while testing it on my phone it does not quit out of the app. So when I open it again it does not execute the delegate methods like - (void)viewWillAppear:(BOOL)animated, it just seems to keep running from where it left off.

Right now I am trying to figure out how to have the app update after 3pm for instance. If a restaurant wants to change a special they are running for that night I upload that new image to the remote site. I have a Method already that checks modification date and time of the remote file and compares it to once stored locally, It downloads new files if there is a change. Hard Part is done!

Right now I have that Method attached to a UIbutton and when pressed it checks ALL the remote files using an NSThread so it runs in the background. But it seems pointless to check the whole site every time they press the button.

Can someone recommend an idea, or push me in the right direction so I can schedule this? Or is there some delegate method I do not know about that is executed when your app wakes from sleep, I guess you call it sleep since it is not a full launch of your app again, otherwise I could check the current time with a Method like above.

I can do all the coding I just need a method that executes automatically when the app wakes up again, or an idea?

Thanks!
 
Take a look at the UIApplicationDelegate Protocol Reference. There are a number of delegate methods for monitoring the application's state.
 
I found something and it seems to work just fine when I test it with a simple NSLog

Code:
- (void)applicationWillEnterForeground:(UIApplication *)application

I have to laugh because when I looked in the appDelegate.m it was already a default method in there. Some times you can't see the forest thru the trees.

Thanks again!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.