Instance Method インスタンスメソッド

urlSessionDidFinishEvents(forBackgroundURLSession:)

Tells the delegate that all messages enqueued for a session have been delivered. 委任先に、あるセッションに対してエンキューされる全てのメッセージが配達され終わったことを伝えます。

Declaration 宣言

optional func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession)

Parameters パラメータ

session

The session that no longer has any outstanding requests. もはやどんな未解決のリクエストも持たないセッション。

Discussion 議論

In iOS, when a background transfer completes or requires credentials, if your app is no longer running, your app is automatically relaunched in the background, and the app’s UIApplicationDelegate is sent an application(_:handleEventsForBackgroundURLSession:completionHandler:) message. This call contains the identifier of the session that caused your app to be launched. You should then store that completion handler before creating a background configuration object with the same identifier, and creating a session with that configuration. The newly created session is automatically reassociated with ongoing background activity. iOSでは、バックグラウンド転送が完了するまたは資格情報を要求する場合、あなたのアプリがもはや動作していないならば、あなたのアプリは自動的にバックグラウンドで再起動されます、そしてアプリのもつ UIApplicationDelegateapplication(_:handleEventsForBackgroundURLSession:completionHandler:)メッセージを送られます。この呼び出しは、あなたのアプリが起動される原因となったセッションの識別子を含みます。あなたは、それからその完了ハンドラを、バックグラウンド構成設定オブジェクトを同じ識別子で作成する、そしてセッションをその構成設定で作成する前に格納すべきです。新しく作成されたセッションは、進行中のバックグラウンドアクティビティと自動的に再度結びつけられます。

When your app later receives a urlSessionDidFinishEvents(forBackgroundURLSession:) message, this indicates that all messages previously enqueued for this session have been delivered, and that it is now safe to invoke the previously stored completion handler or to begin any internal updates that may result in invoking the completion handler. あなたのアプリが後でurlSessionDidFinishEvents(forBackgroundURLSession:)メッセージを受け取る場合、これはこのセッションに対して以前にエンキューされた全てのメッセージが配達されてしまったこと、そして以前に格納した完了ハンドラを発動するまたは完了ハンドラを発動する結果になる何らかの内部アップデートを始めることが今では安全であることを指し示します。

See Also 参照

Handling Session Life Cycle Changes セッションライフサイクル変化を取り扱う