How to differentiate lock screen and home button (

2019-09-06 07:58发布

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条回答
萌系小妹纸
2楼-- · 2019-09-06 08:41

Have you tried implementing -applicationDidEnterBackground: in your app delegate?

查看更多
登录 后发表回答