开发者

iPhone: How do i get iphone power off/switch off/turn off event/notification?

开发者 https://www.devze.com 2023-02-02 20:12 出处:网络
I\'m trying to get a notification 开发者_JAVA百科when iphone power off/switch off/ turn off. I want make a log file in which i\'ll be writing a timestamp of device when power off/switch off/ turn off

I'm trying to get a notification 开发者_JAVA百科when iphone power off/switch off/ turn off. I want make a log file in which i'll be writing a timestamp of device when power off/switch off/ turn off occurs.


In your application delegate should be the methods:

- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application

you will also be notified when someone push the home button or switch the app.

//EDIT: if you generally want to log the power settings:

go to your iPhone settings and choose 'Developer Settings' (I think there have to be a developer profile installed). There you can enable 'Power Logging'
(the log file would be transferred to your XCode Organizer tool)

0

精彩评论

暂无评论...
验证码 换一张
取 消