Browse Source

Bumped deployment targets to iOS 9.0, macOS 10.11, tvOS 9.0 and watchOS 2.0.

Also cleaned up all OS version checks that are no longer necessary.
Christian Noon 9 years ago
parent
commit
913f98a4f0

+ 5 - 28
Alamofire.xcodeproj/project.pbxproj

@@ -113,8 +113,6 @@
 		4C743D321C22772F00BCB23E /* signed-by-ca2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 4C812C511B535F540017E0BF /* signed-by-ca2.cer */; };
 		4C743D331C22772F00BCB23E /* valid-dns-name.cer in Resources */ = {isa = PBXBuildFile; fileRef = 4C812C521B535F540017E0BF /* valid-dns-name.cer */; };
 		4C743D341C22772F00BCB23E /* valid-uri.cer in Resources */ = {isa = PBXBuildFile; fileRef = 4C812C531B535F540017E0BF /* valid-uri.cer */; };
-		4C7C8D221B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7C8D211B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift */; };
-		4C7C8D231B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7C8D211B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift */; };
 		4C80F9F81BB730EF001B46D2 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0B62501BB1001C009302D3 /* Response.swift */; };
 		4C80F9F91BB730F6001B46D2 /* String+AlamofireTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4CBE7A1BAF700C0024D659 /* String+AlamofireTests.swift */; };
 		4C811F8D1B51856D00E0F59A /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C811F8C1B51856D00E0F59A /* ServerTrustPolicy.swift */; };
@@ -185,7 +183,6 @@
 		4CF627181BA7CC240011A099 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5D19A9674D0040E7D1 /* RequestTests.swift */; };
 		4CF627191BA7CC240011A099 /* ResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5E19A9674D0040E7D1 /* ResponseTests.swift */; };
 		4CF6271A1BA7CC240011A099 /* ResultTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CA028C41B7466C500C84163 /* ResultTests.swift */; };
-		4CF6271B1BA7CC240011A099 /* NSURLSessionConfiguration+AlamofireTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7C8D211B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift */; };
 		4CF6271C1BA7CC240011A099 /* CacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C341BB91B1A865A00C1B34D /* CacheTests.swift */; };
 		4CF6271D1BA7CC240011A099 /* DownloadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8111E5B19A9674D0040E7D1 /* DownloadTests.swift */; };
 		4CF6271E1BA7CC240011A099 /* MultipartFormDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C3238E61B3604DB00FE04AE /* MultipartFormDataTests.swift */; };
@@ -274,7 +271,6 @@
 		4C3D00571C66A8B900D1F709 /* NetworkReachabilityManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkReachabilityManagerTests.swift; sourceTree = "<group>"; };
 		4C4CBE7A1BAF700C0024D659 /* String+AlamofireTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+AlamofireTests.swift"; sourceTree = "<group>"; };
 		4C574E691C67D207000B3128 /* Timeline.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = "<group>"; };
-		4C7C8D211B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSURLSessionConfiguration+AlamofireTests.swift"; sourceTree = "<group>"; };
 		4C811F8C1B51856D00E0F59A /* ServerTrustPolicy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServerTrustPolicy.swift; sourceTree = "<group>"; };
 		4C812C3A1B535F220017E0BF /* alamofire-root-ca.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = "alamofire-root-ca.cer"; path = "alamofire.org/alamofire-root-ca.cer"; sourceTree = "<group>"; };
 		4C812C3D1B535F2E0017E0BF /* alamofire-signing-ca1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = "alamofire-signing-ca1.cer"; path = "alamofire.org/alamofire-signing-ca1.cer"; sourceTree = "<group>"; };
@@ -503,7 +499,6 @@
 		4C7C8D201B9D0D7300948136 /* Extensions */ = {
 			isa = PBXGroup;
 			children = (
-				4C7C8D211B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift */,
 				4C4CBE7A1BAF700C0024D659 /* String+AlamofireTests.swift */,
 			);
 			name = Extensions;
@@ -1055,7 +1050,6 @@
 				4CF6271C1BA7CC240011A099 /* CacheTests.swift in Sources */,
 				4CF627161BA7CC240011A099 /* ManagerTests.swift in Sources */,
 				4CF6271A1BA7CC240011A099 /* ResultTests.swift in Sources */,
-				4CF6271B1BA7CC240011A099 /* NSURLSessionConfiguration+AlamofireTests.swift in Sources */,
 				4C3D005A1C66A8B900D1F709 /* NetworkReachabilityManagerTests.swift in Sources */,
 				4CF6271F1BA7CC240011A099 /* ResponseSerializationTests.swift in Sources */,
 				4CF6271D1BA7CC240011A099 /* DownloadTests.swift in Sources */,
@@ -1157,7 +1151,6 @@
 				F8111E6419A9674D0040E7D1 /* UploadTests.swift in Sources */,
 				4C3D00581C66A8B900D1F709 /* NetworkReachabilityManagerTests.swift in Sources */,
 				F8111E6019A9674D0040E7D1 /* DownloadTests.swift in Sources */,
-				4C7C8D221B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1184,7 +1177,6 @@
 				F829C6C51A7A950600A2CD59 /* ValidationTests.swift in Sources */,
 				4C3D00591C66A8B900D1F709 /* NetworkReachabilityManagerTests.swift in Sources */,
 				F86AEFE81AE6A315007D9C76 /* TLSEvaluationTests.swift in Sources */,
-				4C7C8D231B9D0D9000948136 /* NSURLSessionConfiguration+AlamofireTests.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1245,7 +1237,6 @@
 				SDKROOT = appletvos;
 				SKIP_INSTALL = YES;
 				TARGETED_DEVICE_FAMILY = 3;
-				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
 			name = Debug;
 		};
@@ -1273,7 +1264,6 @@
 				SKIP_INSTALL = YES;
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				TARGETED_DEVICE_FAMILY = 3;
-				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
 			name = Release;
 		};
@@ -1289,7 +1279,6 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.Alamofire-tvOSTests";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
-				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
 			name = Debug;
 		};
@@ -1307,7 +1296,6 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
-				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
 			name = Release;
 		};
@@ -1329,9 +1317,7 @@
 				);
 				INFOPLIST_FILE = Source/Info.plist;
 				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = Alamofire;
 				SDKROOT = macosx;
@@ -1355,9 +1341,7 @@
 				FRAMEWORK_VERSION = A;
 				INFOPLIST_FILE = Source/Info.plist;
 				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = Alamofire;
 				SDKROOT = macosx;
@@ -1459,8 +1443,8 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -1504,8 +1488,8 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SWIFT_VERSION = 3.0;
@@ -1532,7 +1516,6 @@
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				INFOPLIST_FILE = Source/Info.plist;
 				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = Alamofire;
@@ -1558,7 +1541,6 @@
 				ENABLE_TESTABILITY = NO;
 				INFOPLIST_FILE = Source/Info.plist;
 				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = Alamofire;
@@ -1580,7 +1562,6 @@
 					"$(inherited)",
 				);
 				INFOPLIST_FILE = Tests/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1595,7 +1576,6 @@
 				"CODE_SIGN_IDENTITY[sdk=iphonesimulator*]" = "";
 				FRAMEWORK_SEARCH_PATHS = "$(inherited)";
 				INFOPLIST_FILE = Tests/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1618,9 +1598,7 @@
 					"$(inherited)",
 				);
 				INFOPLIST_FILE = Tests/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
@@ -1638,9 +1616,7 @@
 					"$(inherited)",
 				);
 				INFOPLIST_FILE = Tests/Info.plist;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.9;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
@@ -1658,6 +1634,7 @@
 				4CCB207E1D45563900C64D5B /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
 		};
 		4CF627041BA7CB3E0011A099 /* Build configuration list for PBXNativeTarget "Alamofire tvOS" */ = {
 			isa = XCConfigurationList;

+ 8 - 4
Example/iOS Example.xcodeproj/project.pbxproj

@@ -372,13 +372,16 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
 				SWIFT_VERSION = 3.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
+				TVOS_DEPLOYMENT_TARGET = 9.0;
+				WATCHOS_DEPLOYMENT_TARGET = 2.0;
 			};
 			name = Debug;
 		};
@@ -411,19 +414,21 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				MACOSX_DEPLOYMENT_TARGET = 10.11;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SWIFT_VERSION = 3.0;
 				TARGETED_DEVICE_FAMILY = "1,2";
+				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VALIDATE_PRODUCT = YES;
+				WATCHOS_DEPLOYMENT_TARGET = 2.0;
 			};
 			name = Release;
 		};
 		F8111E2419A951050040E7D1 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
 				CLANG_ENABLE_MODULES = YES;
@@ -439,7 +444,6 @@
 		F8111E2519A951050040E7D1 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
 				CLANG_ENABLE_MODULES = YES;

+ 2 - 2
README.md

@@ -31,8 +31,8 @@ In order to keep Alamofire focused specifically on core networking implementatio
 
 ## Requirements
 
-- iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
-- Xcode 7.3+
+- iOS 9.0+ / Mac OS X 10.11+ / tvOS 9.0+ / watchOS 2.0+
+- Xcode 8.0 beta 3+
 
 ## Migration Guides
 

+ 2 - 8
Source/Manager.swift

@@ -63,14 +63,8 @@ public class Manager {
                 let version = info[kCFBundleVersionKey as String] as? String ?? "Unknown"
 
                 let osNameVersion: String = {
-                    let versionString: String
-
-                    if #available(OSX 10.10, *) {
-                        let version = ProcessInfo.processInfo.operatingSystemVersion
-                        versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
-                    } else {
-                        versionString = "10.9"
-                    }
+                    let version = ProcessInfo.processInfo.operatingSystemVersion
+                    let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
 
                     let osName: String = {
                         #if os(iOS)

+ 7 - 9
Source/MultipartFormData.swift

@@ -254,11 +254,7 @@ public class MultipartFormData {
         //              Check 2 - is file URL reachable?
         //============================================================
 
-        var isReachable = true
-
-        if #available(OSX 10.10, *) {
-            isReachable = (fileURL as NSURL).checkPromisedItemIsReachableAndReturnError(nil)
-        }
+        let isReachable = (fileURL as NSURL).checkPromisedItemIsReachableAndReturnError(nil)
 
         guard isReachable else {
             setBodyPartError(code: NSURLErrorBadURL, failureReason: "The file URL is not reachable: \(fileURL)")
@@ -271,8 +267,9 @@ public class MultipartFormData {
 
         var isDirectory: ObjCBool = false
 
-        guard let path = fileURL.path,
-              FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory else
+        guard
+            let path = fileURL.path,
+            FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory else
         {
             let failureReason = "The file URL is a directory, not a file: \(fileURL)"
             setBodyPartError(code: NSURLErrorBadURL, failureReason: failureReason)
@@ -286,8 +283,9 @@ public class MultipartFormData {
         var bodyContentLength: UInt64?
 
         do {
-            if let path = fileURL.path,
-               let fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber
+            if
+                let path = fileURL.path,
+                let fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber
             {
                 bodyContentLength = fileSize.uint64Value
             }

+ 1 - 33
Source/ParameterEncoding.swift

@@ -225,38 +225,6 @@ public enum ParameterEncoding {
         var allowedCharacterSet = NSMutableCharacterSet.urlQueryAllowed
         allowedCharacterSet.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)")
 
-        var escaped = ""
-
-        //==========================================================================================================
-        //
-        //  Batching is required for escaping due to an internal bug in iOS 8.1 and 8.2. Encoding more than a few
-        //  hundred Chinese characters causes various malloc error crashes. To avoid this issue until iOS 8 is no
-        //  longer supported, batching MUST be used for encoding. This introduces roughly a 20% overhead. For more
-        //  info, please refer to:
-        //
-        //      - https://github.com/Alamofire/Alamofire/issues/206
-        //
-        //==========================================================================================================
-
-        if #available(iOS 8.3, OSX 10.10, *) {
-            escaped = string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? string
-        } else {
-            let batchSize = 50
-            var index = string.startIndex
-
-            while index != string.endIndex {
-                let startIndex = index
-                let endIndex = string.index(index, offsetBy: batchSize, limitedBy: string.endIndex)
-                let range = startIndex..<(endIndex ?? string.endIndex)
-
-                let substring = string.substring(with: range)
-
-                escaped += substring.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? substring
-
-                index = endIndex ?? string.endIndex
-            }
-        }
-
-        return escaped
+        return string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? string
     }
 }

+ 2 - 4
Source/Request.swift

@@ -233,12 +233,10 @@ public class Request {
             self.progress = Progress(totalUnitCount: 0)
             self.queue = {
                 let operationQueue = OperationQueue()
+
                 operationQueue.maxConcurrentOperationCount = 1
                 operationQueue.isSuspended = true
-
-                if #available(OSX 10.10, *) {
-                    operationQueue.qualityOfService = QualityOfService.utility
-                }
+                operationQueue.qualityOfService = .utility
 
                 return operationQueue
             }()

+ 1 - 8
Source/Upload.swift

@@ -281,14 +281,7 @@ extension Manager {
         encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold,
         encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?)
     {
-
-        let attributes: DispatchQueue.GlobalAttributes
-        if #available(OSXApplicationExtension 10.10, *) {
-            attributes = DispatchQueue.GlobalAttributes.qosDefault
-        } else {
-            attributes = []
-        }
-        DispatchQueue.global(attributes: attributes).async {
+        DispatchQueue.global(attributes: .qosUtility).async {
             let formData = MultipartFormData()
             multipartFormData(formData)
 

+ 14 - 42
Tests/CacheTests.swift

@@ -238,20 +238,6 @@ class CacheTestCase: BaseTestCase {
         }
     }
 
-    // MARK: - Cache Helper Methods
-
-    private func isCachedResponseForNoStoreHeaderExpected() -> Bool {
-        #if os(iOS)
-            if #available(iOS 8.3, *) {
-                return false
-            } else {
-                return true
-            }
-        #else
-            return false
-        #endif
-    }
-
     // MARK: - Tests
 
     func testURLCacheContainsCachedResponsesForAllRequests() {
@@ -277,12 +263,7 @@ class CacheTestCase: BaseTestCase {
         XCTAssertNotNil(maxAgeNonExpiredResponse, "\(CacheControl.MaxAgeNonExpired) response should not be nil")
         XCTAssertNotNil(maxAgeExpiredResponse, "\(CacheControl.MaxAgeExpired) response should not be nil")
         XCTAssertNotNil(noCacheResponse, "\(CacheControl.NoCache) response should not be nil")
-
-        if isCachedResponseForNoStoreHeaderExpected() {
-            XCTAssertNotNil(noStoreResponse, "\(CacheControl.NoStore) response should not be nil")
-        } else {
-            XCTAssertNil(noStoreResponse, "\(CacheControl.NoStore) response should be nil")
-        }
+        XCTAssertNil(noStoreResponse, "\(CacheControl.NoStore) response should be nil")
     }
 
     func testDefaultCachePolicy() {
@@ -315,12 +296,7 @@ class CacheTestCase: BaseTestCase {
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeNonExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoCache, shouldReturnCachedResponse: true)
-
-        if isCachedResponseForNoStoreHeaderExpected() {
-            executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: true)
-        } else {
-            executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: false)
-        }
+        executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: false)
     }
 
     func testUseLocalCacheDataAndDontLoadFromNetworkPolicy() {
@@ -332,23 +308,19 @@ class CacheTestCase: BaseTestCase {
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.MaxAgeExpired, shouldReturnCachedResponse: true)
         executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoCache, shouldReturnCachedResponse: true)
 
-        if isCachedResponseForNoStoreHeaderExpected() {
-            executeTest(cachePolicy: cachePolicy, cacheControl: CacheControl.NoStore, shouldReturnCachedResponse: true)
-        } else {
-            // Given
-            let expectation = self.expectation(description: "GET request to httpbin")
-            var response: HTTPURLResponse?
-
-            // When
-            startRequest(cacheControl: CacheControl.NoStore, cachePolicy: cachePolicy) { _, responseResponse in
-                response = responseResponse
-                expectation.fulfill()
-            }
-
-            waitForExpectations(timeout: timeout, handler: nil)
+        // Given
+        let expectation = self.expectation(description: "GET request to httpbin")
+        var response: HTTPURLResponse?
 
-            // Then
-            XCTAssertNil(response, "response should be nil")
+        // When
+        startRequest(cacheControl: CacheControl.NoStore, cachePolicy: cachePolicy) { _, responseResponse in
+            response = responseResponse
+            expectation.fulfill()
         }
+
+        waitForExpectations(timeout: timeout, handler: nil)
+
+        // Then
+        XCTAssertNil(response, "response should be nil")
     }
 }

+ 1 - 2
Tests/ManagerTests.swift

@@ -216,7 +216,6 @@ class ManagerConfigurationHeadersTestCase: BaseTestCase {
         executeAuthorizationHeaderTestForConfigurationType(.ephemeral)
     }
 
-
 //    ⚠️ This test has been removed as a result of rdar://26870455 in Xcode 8 Seed 1
 //    func testThatBackgroundConfigurationHeadersAreSentWithRequest() {
 //        // Given, When, Then
@@ -236,7 +235,7 @@ class ManagerConfigurationHeadersTestCase: BaseTestCase {
                     configuration = .ephemeral
                 case .background:
                     let identifier = "com.alamofire.test.manager-configuration-tests"
-                    configuration = .backgroundSessionConfigurationForAllPlatformsWithIdentifier(identifier)
+                    configuration = .background(withIdentifier: identifier)
                 }
 
                 var headers = Alamofire.Manager.defaultHTTPHeaders

+ 0 - 39
Tests/NSURLSessionConfiguration+AlamofireTests.swift

@@ -1,39 +0,0 @@
-//
-//  NSURLSessionConfiguration+AlamofireTests.swift
-//
-//  Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to deal
-//  in the Software without restriction, including without limitation the rights
-//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-//  copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-//  THE SOFTWARE.
-//
-
-import Foundation
-
-extension URLSessionConfiguration {
-    static func backgroundSessionConfigurationForAllPlatformsWithIdentifier(_ identifier: String) -> URLSessionConfiguration {
-        let configuration: URLSessionConfiguration
-
-        if #available(OSX 10.10, *) {
-            configuration = URLSessionConfiguration.background(withIdentifier: identifier)
-        } else {
-            configuration = URLSessionConfiguration.backgroundSessionConfiguration(identifier)
-        }
-
-        return configuration
-    }
-}

+ 34 - 48
Tests/SessionDelegateTests.swift

@@ -64,67 +64,53 @@ class SessionDelegateTestCase: BaseTestCase {
     // MARK: - Tests - Session Challenges
 
     func testThatSessionDidReceiveChallengeClosureIsCalledWhenSet() {
-        if #available(iOS 9.0, *) {
-            // Given
-            let expectation = self.expectation(description: "Override closure should be called")
+        // Given
+        let expectation = self.expectation(description: "Override closure should be called")
 
-            var overrideClosureCalled = false
-            var response: HTTPURLResponse?
+        var overrideClosureCalled = false
+        var response: HTTPURLResponse?
 
-            manager.delegate.sessionDidReceiveChallenge = { session, challenge in
-                overrideClosureCalled = true
-                return (.performDefaultHandling, nil)
-            }
+        manager.delegate.sessionDidReceiveChallenge = { session, challenge in
+            overrideClosureCalled = true
+            return (.performDefaultHandling, nil)
+        }
 
-            // When
-            manager.request(.GET, "https://httpbin.org/get").responseJSON { closureResponse in
-                response = closureResponse.response
-                expectation.fulfill()
-            }
+        // When
+        manager.request(.GET, "https://httpbin.org/get").responseJSON { closureResponse in
+            response = closureResponse.response
+            expectation.fulfill()
+        }
 
-            waitForExpectations(timeout: timeout, handler: nil)
+        waitForExpectations(timeout: timeout, handler: nil)
 
-            // Then
-            XCTAssertTrue(overrideClosureCalled)
-            XCTAssertEqual(response?.statusCode, 200)
-        } else {
-            // This test MUST be disabled on iOS 8.x because `respondsToSelector` is not being called for the
-            // `URLSession:didReceiveChallenge:completionHandler:` selector when more than one test here is run
-            // at a time. Whether we flush the URL session of wipe all the shared credentials, the behavior is
-            // still the same. Until we find a better solution, we'll need to disable this test on iOS 8.x.
-        }
+        // Then
+        XCTAssertTrue(overrideClosureCalled)
+        XCTAssertEqual(response?.statusCode, 200)
     }
 
     func testThatSessionDidReceiveChallengeWithCompletionClosureIsCalledWhenSet() {
-        if #available(iOS 9.0, *) {
-            // Given
-            let expectation = self.expectation(description: "Override closure should be called")
+        // Given
+        let expectation = self.expectation(description: "Override closure should be called")
 
-            var overrideClosureCalled = false
-            var response: HTTPURLResponse?
+        var overrideClosureCalled = false
+        var response: HTTPURLResponse?
 
-            manager.delegate.sessionDidReceiveChallengeWithCompletion = { session, challenge, completion in
-                overrideClosureCalled = true
-                completion(.performDefaultHandling, nil)
-            }
+        manager.delegate.sessionDidReceiveChallengeWithCompletion = { session, challenge, completion in
+            overrideClosureCalled = true
+            completion(.performDefaultHandling, nil)
+        }
 
-            // When
-            manager.request(.GET, "https://httpbin.org/get").responseJSON { closureResponse in
-                response = closureResponse.response
-                expectation.fulfill()
-            }
+        // When
+        manager.request(.GET, "https://httpbin.org/get").responseJSON { closureResponse in
+            response = closureResponse.response
+            expectation.fulfill()
+        }
 
-            waitForExpectations(timeout: timeout, handler: nil)
+        waitForExpectations(timeout: timeout, handler: nil)
 
-            // Then
-            XCTAssertTrue(overrideClosureCalled)
-            XCTAssertEqual(response?.statusCode, 200)
-        } else {
-            // This test MUST be disabled on iOS 8.x because `respondsToSelector` is not being called for the
-            // `URLSession:didReceiveChallenge:completionHandler:` selector when more than one test here is run
-            // at a time. Whether we flush the URL session of wipe all the shared credentials, the behavior is
-            // still the same. Until we find a better solution, we'll need to disable this test on iOS 8.x.
-        }
+        // Then
+        XCTAssertTrue(overrideClosureCalled)
+        XCTAssertEqual(response?.statusCode, 200)
     }
 
     // MARK: - Tests - Redirects

+ 1 - 7
Tests/URLProtocolTests.swift

@@ -169,13 +169,7 @@ class URLProtocolTestCase: BaseTestCase {
 
         if let headers = response?.allHeaderFields as? [String: String] {
             XCTAssertEqual(headers["request-header"], "foobar")
-
-            // Configuration headers are only passed in on iOS 9.0+
-            if #available(iOS 9.0, *) {
-                XCTAssertEqual(headers["session-configuration-header"], "foo")
-            } else {
-                XCTAssertNil(headers["session-configuration-header"])
-            }
+            XCTAssertEqual(headers["session-configuration-header"], "foo")
         } else {
             XCTFail("headers should not be nil")
         }