I am currently writing my app that makes a connection to parse the time from a website, and then triggers a timer for 60 seconds. After that 60 seconds it reloads the connection, and gets the newest time from the site.
I am trying to make it so, when the app goes into the background and then comes to the foreground, it knows to start a new connection right away. I am doing this with NSNotification.
But reading through the docs, I dont know which one i should use
UIApplicationDidBecomeActiveNotification
or
UIApplicationWillEnterForegroundNotification
are there any big differences between these to, and any situations where one should be called instead of the other.
The only thing I can think of, is with NSURL connections, I should maybe use WillEnterForeground, so it starts to get things rolling as the view is coming back. Or is that the wrong way to think about it, that I should wait until my view is fully loaded before trying to do any thing with loading data.
They are different.
UIApplicationWillEnterForegroundNotification will NOT be posted when from sleep mode or call, but only when do multi-task operation.
UIApplicationDidBecomeActiveNotification will be posted when the phone returns to your app from sleep mode or from other app (finished an incoming call or clicked OK button of low battery warning). It will also be called when your app come back from background.
In your situation, I think use UIApplicationDidBecomeActiveNotification will be better.