Swift

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

More than 1 year has 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
}