My device is sleep when my app is open in foreground
I have added below line inside of didFinishLaunchingWithOptions method in AppDelegate but it's not working
UIApplication.shared.isIdleTimerDisabled = true
I don't want to sleep my device while my app is open in foreground
Are you trying this when you Run from Xcode? Running from Xcode always disables the idle timer, regardless if you set UIApplication.shared.isIdleTimerDisabled
or not. You can try it by manually opening the app from the iPhone/iPod touch/iPad.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.