问题
I am writing an alarm clock app.
Please correct me if I am wrong:
On both events (lock & home button in iOS 4.x) the applicationWillResignActive: method is called. When locked my app can keep on running (forever if DeepSleepPreventer.h is used) to check if the alarm should go off. When home is pressed it has to stop working at some time (apart from some basic background calculations). So in this case I have to set a local UILocalNotification to trigger the alarm.
So my question: How to differentiate between those two events?
Thank you!
回答1:
Have you tried implementing -applicationDidEnterBackground:
in your app delegate?
来源:https://stackoverflow.com/questions/4783152/how-to-differentiate-lock-screen-and-home-button-background-multitasking-on-ap