Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
アイドルタイマーを無効にするアプリを書いています。アプリがクラッシュしたり、ユーザーがメインの終了ボタンを押す前に、再度有効にするにはどうすればよいですか?そうしないと、バッテリーを消耗するため、これは本当に悪いことになる可能性があります。
メソッドで再度有効にすることができます- (void)applicationWillResignActive:(UIApplication *)application。
- (void)applicationWillResignActive:(UIApplication *)application
これを使用できます:[[UIApplication sharedApplication] setIdleTimerDisabled:NO]。アプリがアクティブになったら、もう一度無効にすることを忘れないでください。
[[UIApplication sharedApplication] setIdleTimerDisabled:NO]