更新时间:2022-05-02 22:21:58
此代码将阻止您的iPhone在您的应用运行时进入休眠状态
This code will prevent your iPhone from going to sleep while your app is running
// avoid sleeping when this application is running
UIApplication *application = [UIApplication sharedApplication];
application.idleTimerDisabled = YES;
// Or simpler
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];