Browse Source

[Issue 728] Background completion handler is now always called on main queue.

Christian Noon 10 years ago
parent
commit
4264b9d521
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Source/Manager.swift

+ 2 - 3
Source/Manager.swift

@@ -132,9 +132,8 @@ public class Manager {
         self.session.serverTrustPolicyManager = serverTrustPolicyManager
 
         self.delegate.sessionDidFinishEventsForBackgroundURLSession = { [weak self] session in
-            if let strongSelf = self {
-                strongSelf.backgroundCompletionHandler?()
-            }
+            guard let strongSelf = self else { return }
+            dispatch_async(dispatch_get_main_queue()) { strongSelf.backgroundCompletionHandler?() }
         }
     }