iOSでバックライトを消灯させない方法
UIApplicationクラスのプロパティで設定できる。
idleTimerDisabled
というプロパティをYES
にすればok
UIApplication *application = [UIApplication sharedApplication]; application.idleTimerDisabled = YES;
また、
You should set this property only if necessary and should be sure to reset it to NO when the need no longer exists. Most apps should let the system turn off the screen when the idle timer elapses.
とあり他のアプリのためにアプリがバックグラウンドに回ったりした時にはちゃんとこのプロパティをNO
に戻してあげないといけないらしい。
application.idleTimerDisabled = NO;
そしてiPhoneをMacにつなげてアプリをXcodeから立ち上げてる場合はロックされないらしい。ずっと待ってた時間を返せ...笑
クラスのもつプロパティってアプリごとにもってるんじゃなくてOSや端末ごとに保持してるのかな。難しいなiOS
他参考にさせていただいたサイト
iOS 用アプリケーションでバックライトを常時点灯する - 株式会社アトトック