4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【swift3】バックグラウンド処理有効化

Last updated at Posted at 2017-06-30

備忘録として。

AppDelegateクラス内で以下を定義

var backgroundTaskID : UIBackgroundTaskIdentifier = 0

applicationWillResignActive内に以下を追記

self.backgroundTaskID = application.beginBackgroundTask(){
[weak self] in
application.endBackgroundTask((self?.backgroundTaskID)!)
self?.backgroundTaskID = UIBackgroundTaskInvalid
}

applicationDidBecomeActive内に以下を追記

application.endBackgroundTask(self.backgroundTaskID)

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?