Browse Source

Fixed compiler issue on OS X when creating the background configuration.

Christian Noon 10 years ago
parent
commit
bf86ff500d
1 changed files with 10 additions and 1 deletions
  1. 10 1
      Tests/ManagerTests.swift

+ 10 - 1
Tests/ManagerTests.swift

@@ -124,7 +124,16 @@ class ManagerConfigurationHeadersTestCase: BaseTestCase {
                     configuration = NSURLSessionConfiguration.ephemeralSessionConfiguration()
                 case .Background:
                     let identifier = "com.alamofire.test.manager-configuration-tests"
-                    configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(identifier)
+
+                    #if os(iOS) || os(watchOS)
+                        configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(identifier)
+                    #else
+                        if #available(OSX 10.10, *) {
+                            configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(identifier)
+                        } else {
+                            configuration = NSURLSessionConfiguration.backgroundSessionConfiguration(identifier)
+                        }
+                    #endif
                 }
 
                 var headers = Alamofire.Manager.defaultHTTPHeaders