iPhone - phone goes to sleep even if idleTimerDisabled is YES

前端 未结 9 1376
难免孤独
难免孤独 2020-11-30 03:45

I am using this in my appdelegate\'s applicationDidFinishLaunching: method to make sure the iPhone doesn\'t go to sleep during the time the app is open

[appl         


        
9条回答
  •  渐次进展
    2020-11-30 04:04

    Set this property in the application delegate's +initialize method, e.g.:

    + (void) initialize {   
        if ([self class] == [MyAppDelegate class]) {
            UIApplication* myApp = [UIApplication sharedApplication];
            myApp.idleTimerDisabled = YES;
        }
    }
    

提交回复
热议问题