Browse Source

Merge branch 'master' into tvOS

Christian Noon 10 years ago
parent
commit
da2daa2d82
3 changed files with 20 additions and 12 deletions
  1. 6 0
      Alamofire.xcodeproj/project.pbxproj
  2. 1 1
      Documentation/Alamofire 3.0 Migration Guide.md
  3. 13 11
      README.md

+ 6 - 0
Alamofire.xcodeproj/project.pbxproj

@@ -1127,6 +1127,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
+				BITCODE_GENERATION_MODE = bitcode;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
 				COMBINE_HIDPI_IMAGES = YES;
 				DEFINES_MODULE = YES;
@@ -1154,6 +1155,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
+				BITCODE_GENERATION_MODE = bitcode;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
 				COMBINE_HIDPI_IMAGES = YES;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -1179,6 +1181,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
+				BITCODE_GENERATION_MODE = bitcode;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
@@ -1205,6 +1208,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
+				BITCODE_GENERATION_MODE = bitcode;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
@@ -1322,6 +1326,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
+				BITCODE_GENERATION_MODE = bitcode;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				DEFINES_MODULE = YES;
@@ -1344,6 +1349,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
+				BITCODE_GENERATION_MODE = bitcode;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				DEFINES_MODULE = YES;

+ 1 - 1
Documentation/Alamofire 3.0 Migration Guide.md

@@ -57,7 +57,7 @@ These changes allow Alamofire to return the original server data in both cases.
 
 ### Response
 
-In order to avoid constantly having to change the response serializer completion closure signatures, ALamofire 3.0 introduces a `Response` struct. All response serializers (with the exception of `response`) return a generic `Response` struct.
+In order to avoid constantly having to change the response serializer completion closure signatures, Alamofire 3.0 introduces a `Response` struct. All response serializers (with the exception of `response`) return a generic `Response` struct.
 
 ```swift
 public struct Response<Value, Error: ErrorType> {

+ 13 - 11
README.md

@@ -412,12 +412,10 @@ Alamofire.upload(
 ```swift
 Alamofire.download(.GET, "http://httpbin.org/stream/100") { temporaryURL, response in
     let fileManager = NSFileManager.defaultManager()
-    if let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as? NSURL {
-        let pathComponent = response.suggestedFilename
-        return directoryURL.URLByAppendingPathComponent(pathComponent!)
-    }
+    let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0]
+    let pathComponent = response.suggestedFilename
 
-    return temporaryURL
+    return directoryURL.URLByAppendingPathComponent(pathComponent!)
 }
 ```
 
@@ -437,12 +435,16 @@ Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destinati
 
              // This closure is NOT called on the main queue for performance
              // reasons. To update your ui, dispatch to the main queue.
-             dispatch_async(dispatch_get_main_queue) {
+             dispatch_async(dispatch_get_main_queue()) {
                  print("Total bytes read on main queue: \(totalBytesRead)")
              }
          }
-         .responseData { response in
-             print(response)
+         .response { _, _, _, error in
+             if let error = error {
+                 print("Failed with error: \(error)")
+             } else {
+                 print("Downloaded file successfully")
+             }
          }
 ```
 
@@ -450,9 +452,9 @@ Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destinati
 
 ```swift
 Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destination)
-         .responseData { response in
+         .response { _, _, data, _ in
              if let
-                 data = response.data,
+                 data = data,
                  resumeDataString = NSString(data: data, encoding: NSUTF8StringEncoding)
              {
                  print("Resume Data: \(resumeDataString)")
@@ -466,7 +468,7 @@ Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destinati
 
 ```swift
 let download = Alamofire.download(.GET, "http://httpbin.org/stream/100", destination: destination)
-download.responseData { _ in
+download.response { _, _, _, _ in
     if let
         resumeData = download.resumeData,
         resumeDataString = NSString(data: resumeData, encoding: NSUTF8StringEncoding)