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

robotspacer

macrumors member
Original poster
Jun 25, 2007
46
0
Basically I'd like to have my app update automatically when the phone is unlocked. Obviously this would only work if the app is already running—that's fine. Any ideas on how to accomplish this, or even if it's possible? Maybe a notification I can use with NSNotificationCenter...?

Unfortunately searches aren't helping much—every result is about the other kind of unlocking!
 

Luke Redpath

macrumors 6502a
Nov 9, 2007
733
6
Colchester, UK
UIApplicationDelegate:

applicationDidBecomeActive:
Tells the delegate that the application has become active. This method is optional.

- (void)applicationDidBecomeActive:(UIApplication *)application

Parameters
application
The singleton application instance.

Discussion
The delegate can implement this method to make adjustments when the application transitions from an inactive state to an active state. When an application is inactive, it is executing but is not dispatching incoming events. This occurs when an overlay window pops up or when the device is locked.

Just after it becomes active, the application also posts a UIApplicationDidBecomeActiveNotification.

Availability
Available in iPhone OS 2.0 and later.
Declared In
UIApplication.h

As the docs say, it also posts a notification so you could use NSNotificationCentre to respond to this elsewhere in your code.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.