Posted at

iOSアプリ起動中にスリープしないようにする

More than 3 years have passed since last update.

AppDelegate.swiftのapplication:didFinishLaunchingWithOptions:などでUIApplicationのidleTimerDisabledにtrueを入れてやれば良い。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

UIApplication.sharedApplication().idleTimerDisabled = true
return true
}