diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000000..951b97b9d6 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "Tests" diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000000..7d2ed51c3c --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,33 @@ +> ℹ Please fill out this template when filing an issue. +> All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info. +> +> Per our [*CONTRIBUTING guidelines](https://github.com/AFNetworking/AFNetworking/blob/master/CONTRIBUTING.md), we use GitHub for +> bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag `afnetworking`. +> +> Please remove this line and everything above it before submitting. + +* [ ] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/AFNetworking/AFNetworking/blob/master/CONTRIBUTING.md). + +## What did you do? + +ℹ Please replace this with what you did. + +## What did you expect to happen? + +ℹ Please replace this with what you expected to happen. + +## What happened instead? + +ℹ Please replace this with of what happened instead. + +## AFNetworking Environment + +**AFNetworking version:** +**Xcode version:** +**Swift version:** +**Platform(s) running AFNetworking:** +**macOS version running Xcode:** + +## Demo Project + +ℹ Please link to or upload a project we can download that reproduces the issue. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..6e04c37480 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,13 @@ +### Issue Link :link: + + +### Goals :soccer: + + + +### Implementation Details :construction: + + + +### Testing Details :mag: + diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000000..97dfa19284 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,34 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 14 + +# Number of days of inactivity before a stale Issue or Pull Request is closed +daysUntilClose: 7 + +# Issues or Pull Requests with these labels will never be considered stale + exemptLabels: + - "support" + - "bug" + - "security" + - "needs investigation" + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. + +# Comment to post when removing the stale label. Set to `false` to disable +unmarkComment: false + +# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable +closeComment: > + This issue has been auto-closed because there hasn't been any activity for at least 21 days. + However, we really appreciate your contribution, so thank you for that! 🙏 + Also, feel free to [open a new issue](https://github.com/AFNetworking/AFNetworking/issues/new) if you still experience this problem 👍. + +# Limit to only `issues` +only: issues diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..ec939bbbbd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: "AFNetworking CI" + +on: + push: + branches: + - master + pull_request: + branches: + - '*' + +jobs: + macOS: + name: Test macOS + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer + steps: + - uses: actions/checkout@v2 + - name: macOS + run: fastlane ci_commit configuration:Debug --env macos + iOS: + name: Test iOS + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer + steps: + - uses: actions/checkout@v2 + - name: iOS + run: fastlane ci_commit configuration:Debug --env ios13_xcode11 + Catalyst: + name: Test Catalyst + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer + steps: + - uses: actions/checkout@v2 + - name: Catalyst + run: fastlane ci_commit configuration:Debug --env catalyst + tvOS: + name: Test tvOS + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer + steps: + - uses: actions/checkout@v2 + - name: tvOS + run: fastlane ci_commit configuration:Debug --env tvos13_xcode11 + watchOS: + name: Build watchOS + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer + strategy: + matrix: + destination: ["OS=6.1.1,name=Apple Watch Series 5 - 44mm"] #, "OS=4.2,name=Apple Watch Series 3 - 42mm", "OS=3.2,name=Apple Watch Series 2 - 42mm"] + steps: + - uses: actions/checkout@v2 + - name: watchOS - ${{ matrix.destination }} + run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "AFNetworking.xcodeproj" -scheme "AFNetworking watchOS" -destination "${{ matrix.destination }}" clean build | xcpretty + SPM: + name: Build with SPM + runs-on: macOS-latest + env: + DEVELOPER_DIR: /Applications/Xcode_11.3.1.app/Contents/Developer + steps: + - uses: actions/checkout@v2 + - name: SPM Build + run: swift build diff --git a/.gitignore b/.gitignore index 7ae51cf6fb..cddadc3052 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,9 @@ AFNetworking.framework.zip # Fastlane /fastlane/report.xml /fastlane/.env*private* -fastlane/test-output/* \ No newline at end of file +fastlane/test-output/* + +Carthage/Build + +fastlane/README.md +.build diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000000..0edabf3396 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +afnetworking diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000000..944880fa15 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 31d4eba6dc..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,53 +0,0 @@ -language: objective-c -osx_image: xcode7.1 -sudo: false -env: - global: - - LC_CTYPE=en_US.UTF-8 - - LANG=en_US.UTF-8 - - FASTLANE_LANE=ci_commit -matrix: - include: - - osx_image: xcode7.2 - env: FASTLANE_LANE=code_coverage FASTLANE_ENV=default - - osx_image: xcode7.2 - env: FASTLANE_ENV=ios82 - - osx_image: xcode7.2 - env: FASTLANE_ENV=ios83 - - osx_image: xcode7.2 - env: FASTLANE_ENV=ios84 - - osx_image: xcode7.2 - env: FASTLANE_ENV=ios92 - - osx_image: xcode7.2 - env: FASTLANE_ENV=tvos91 - - osx_image: xcode7.2 - env: FASTLANE_ENV=osx - - osx_image: xcode7.1 - env: FASTLANE_ENV=ios91_xcode71 - - osx_image: xcode7.1 - env: FASTLANE_ENV=tvos90_xcode71 - - osx_image: xcode7 - env: FASTLANE_ENV=ios81_xcode7 - - osx_image: xcode7 - env: FASTLANE_ENV=ios90_xcode7 -before_install: - - gem install fastlane --no-rdoc --no-ri --no-document --quiet - - gem install cocoapods --no-rdoc --no-ri --no-document --quiet - - gem install xcpretty --no-rdoc --no-ri --no-document --quiet -script: - - set -o pipefail - - fastlane $FASTLANE_LANE configuration:Debug --env $FASTLANE_ENV - - fastlane $FASTLANE_LANE configuration:Release --env $FASTLANE_ENV -after_success: - - if [ "$FASTLANE_LANE" == "code_coverage" ]; then - bash <(curl -s https://codecov.io/bash); - fi -after_failure: - - cat -n ~/Library/Logs/scan/* - - cat -n $TMPDIR/com.apple.dt.XCTest-status/Session*.log - - cat -n ~/Library/Logs/DiagnosticReports/xctest*.crash -# deploy: -# provider: script -# script: fastlane complete_framework_release --env deploy -# on: -# tags: true diff --git a/AFNetworking.podspec b/AFNetworking.podspec index 3241d77bc5..ef110340b5 100644 --- a/AFNetworking.podspec +++ b/AFNetworking.podspec @@ -1,60 +1,39 @@ Pod::Spec.new do |s| s.name = 'AFNetworking' - s.version = '3.0.4' + s.version = '4.0.1' s.license = 'MIT' - s.summary = 'A delightful iOS and OS X networking framework.' + s.summary = 'A delightful networking framework for Apple platforms.' s.homepage = 'https://github.com/AFNetworking/AFNetworking' s.social_media_url = 'https://twitter.com/AFNetworking' s.authors = { 'Mattt Thompson' => 'm@mattt.me' } - s.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => s.version, :submodules => true } - s.requires_arc = true - - s.public_header_files = 'AFNetworking/AFNetworking.h' - s.source_files = 'AFNetworking/AFNetworking.h' - - pch_AF = <<-EOS -#ifndef TARGET_OS_IOS - #define TARGET_OS_IOS TARGET_OS_IPHONE -#endif - -#ifndef TARGET_OS_WATCH - #define TARGET_OS_WATCH 0 -#endif + s.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => s.version } -#ifndef TARGET_OS_TV - #define TARGET_OS_TV 0 -#endif -EOS - s.prefix_header_contents = pch_AF - - s.ios.deployment_target = '7.0' - s.osx.deployment_target = '10.9' + s.ios.deployment_target = '9.0' + s.osx.deployment_target = '10.10' s.watchos.deployment_target = '2.0' s.tvos.deployment_target = '9.0' - + + s.ios.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER' => 'com.alamofire.AFNetworking' } + s.osx.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER' => 'com.alamofire.AFNetworking' } + s.watchos.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER' => 'com.alamofire.AFNetworking-watchOS' } + s.tvos.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER' => 'com.alamofire.AFNetworking' } + + s.source_files = 'AFNetworking/AFNetworking.h' + s.subspec 'Serialization' do |ss| ss.source_files = 'AFNetworking/AFURL{Request,Response}Serialization.{h,m}' - ss.public_header_files = 'AFNetworking/AFURL{Request,Response}Serialization.h' - ss.watchos.frameworks = 'MobileCoreServices', 'CoreGraphics' - ss.ios.frameworks = 'MobileCoreServices', 'CoreGraphics' - ss.osx.frameworks = 'CoreServices' end s.subspec 'Security' do |ss| ss.source_files = 'AFNetworking/AFSecurityPolicy.{h,m}' - ss.public_header_files = 'AFNetworking/AFSecurityPolicy.h' - ss.frameworks = 'Security' end s.subspec 'Reachability' do |ss| - ss.ios.deployment_target = '7.0' - ss.osx.deployment_target = '10.9' + ss.ios.deployment_target = '9.0' + ss.osx.deployment_target = '10.10' ss.tvos.deployment_target = '9.0' ss.source_files = 'AFNetworking/AFNetworkReachabilityManager.{h,m}' - ss.public_header_files = 'AFNetworking/AFNetworkReachabilityManager.h' - - ss.frameworks = 'SystemConfiguration' end s.subspec 'NSURLSession' do |ss| @@ -64,16 +43,14 @@ EOS ss.tvos.dependency 'AFNetworking/Reachability' ss.dependency 'AFNetworking/Security' - ss.source_files = 'AFNetworking/AF{URL,HTTP}SessionManager.{h,m}' - ss.public_header_files = 'AFNetworking/AF{URL,HTTP}SessionManager.h' + ss.source_files = 'AFNetworking/AF{URL,HTTP}SessionManager.{h,m}', 'AFNetworking/AFCompatibilityMacros.h' end s.subspec 'UIKit' do |ss| - ss.ios.deployment_target = '7.0' + ss.ios.deployment_target = '9.0' ss.tvos.deployment_target = '9.0' ss.dependency 'AFNetworking/NSURLSession' - ss.public_header_files = 'UIKit+AFNetworking/*.h' ss.source_files = 'UIKit+AFNetworking' end end diff --git a/AFNetworking.xcodeproj/project.pbxproj b/AFNetworking.xcodeproj/project.pbxproj index bfe4a18de7..dcc063410e 100644 --- a/AFNetworking.xcodeproj/project.pbxproj +++ b/AFNetworking.xcodeproj/project.pbxproj @@ -3,10 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 47; objects = { /* Begin PBXBuildFile section */ + 1BF9F9601C87832B00F1F35A /* AFImageResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */; }; + 1BF9F9611C87843200F1F35A /* AFImageResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */; }; + 1BF9F9621C87843300F1F35A /* AFImageResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */; }; + 1F96D2A4203649560085FC3F /* AFCompatibilityMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1F96D2A5203649570085FC3F /* AFCompatibilityMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1F96D2A6203649570085FC3F /* AFCompatibilityMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1F96D2A7203649580085FC3F /* AFCompatibilityMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2960BAC31C1B2F1A00BA02F0 /* AFUIButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */; }; 297824A31BC2D69A0041C395 /* adn_0.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A01BC2D69A0041C395 /* adn_0.cer */; }; 297824A41BC2D69A0041C395 /* adn_0.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A01BC2D69A0041C395 /* adn_0.cer */; }; @@ -48,10 +55,6 @@ 2987B0D51BC40AE900179A4C /* adn_2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A21BC2D69A0041C395 /* adn_2.cer */; }; 2987B0D61BC40AEC00179A4C /* ADNNetServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CDF1BC2CB5A00FD3B3E /* ADNNetServerTrustChain */; }; 2987B0D71BC40AF000179A4C /* HTTPBinOrgServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */; }; - 2987B0D81BC40AF300179A4C /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */; }; - 2987B0D91BC40AF300179A4C /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */; }; - 2987B0DA1BC40AF300179A4C /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; }; - 2987B0DB1BC40AF300179A4C /* httpbinorg_01162016.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C711BC2C88F00FD3B3E /* httpbinorg_01162016.cer */; }; 2987B0DC1BC40AF600179A4C /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C771BC2C88F00FD3B3E /* logo.png */; }; 2987B0DD1BC40AFB00179A4C /* AltName.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C791BC2C88F00FD3B3E /* AltName.cer */; }; 2987B0DE1BC40AFB00179A4C /* foobar.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */; }; @@ -75,14 +78,6 @@ 298D7CBE1BC2CA9D00FD3B3E /* AltName.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C791BC2C88F00FD3B3E /* AltName.cer */; }; 298D7CBF1BC2CA9D00FD3B3E /* foobar.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */; }; 298D7CC01BC2CA9D00FD3B3E /* NoDomains.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7B1BC2C88F00FD3B3E /* NoDomains.cer */; }; - 298D7CC11BC2CAA100FD3B3E /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */; }; - 298D7CC21BC2CAA100FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */; }; - 298D7CC31BC2CAA100FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; }; - 298D7CC41BC2CAA100FD3B3E /* httpbinorg_01162016.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C711BC2C88F00FD3B3E /* httpbinorg_01162016.cer */; }; - 298D7CC51BC2CAA200FD3B3E /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */; }; - 298D7CC61BC2CAA200FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */; }; - 298D7CC71BC2CAA200FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; }; - 298D7CC81BC2CAA200FD3B3E /* httpbinorg_01162016.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C711BC2C88F00FD3B3E /* httpbinorg_01162016.cer */; }; 298D7CD31BC2CAE800FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */; }; 298D7CD41BC2CAE900FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */; }; 298D7CD51BC2CAEC00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */; }; @@ -133,15 +128,12 @@ 299522A31BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */; }; 299522A61BBF13C700859F49 /* UIButton+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 299522A71BBF13C700859F49 /* UIButton+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */; }; - 299522A81BBF13C700859F49 /* UIImage+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 299522A91BBF13C700859F49 /* UIImageView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 299522AA1BBF13C700859F49 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */; }; 299522AC1BBF13C700859F49 /* UIProgressView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522961BBF13C700859F49 /* UIProgressView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 299522AD1BBF13C700859F49 /* UIProgressView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */; }; 299522AE1BBF13C700859F49 /* UIRefreshControl+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522981BBF13C700859F49 /* UIRefreshControl+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 299522AF1BBF13C700859F49 /* UIRefreshControl+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522991BBF13C700859F49 /* UIRefreshControl+AFNetworking.m */; }; - 299522B01BBF13C700859F49 /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995229A1BBF13C700859F49 /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 299522B11BBF13C700859F49 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */; }; 29D3413F1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */; }; 29D341401C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */; }; 29D341411C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */; }; @@ -169,9 +161,18 @@ 29D96E951BCC406B00F571A5 /* AFImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522881BBF13C700859F49 /* AFImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29D96E961BCC406B00F571A5 /* UIActivityIndicatorView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995228C1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29D96E971BCC406B00F571A5 /* UIButton+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 29D96E981BCC406B00F571A5 /* UIImage+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29D96E991BCC406B00F571A5 /* UIImageView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; 29D96E9A1BCC406B00F571A5 /* UIProgressView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522961BBF13C700859F49 /* UIProgressView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2D4563901DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */; }; + 2D4563911DB117A200AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */; }; + 2D4563921DB117A200AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */; }; + 2D4563941DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D4563931DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m */; }; + 31CBC007242D8DF200934333 /* httpbinorg_02182021.cer in Resources */ = {isa = PBXBuildFile; fileRef = 31CBC006242D8DF200934333 /* httpbinorg_02182021.cer */; }; + 31CBC008242D8DF200934333 /* httpbinorg_02182021.cer in Resources */ = {isa = PBXBuildFile; fileRef = 31CBC006242D8DF200934333 /* httpbinorg_02182021.cer */; }; + 31CBC009242D8DF200934333 /* httpbinorg_02182021.cer in Resources */ = {isa = PBXBuildFile; fileRef = 31CBC006242D8DF200934333 /* httpbinorg_02182021.cer */; }; + 323D83E2231D185400C5BFC6 /* WKWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 323D83E0231D185400C5BFC6 /* WKWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 323D83E3231D185400C5BFC6 /* WKWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 323D83E1231D185400C5BFC6 /* WKWebView+AFNetworking.m */; }; + 323D83E5231D188400C5BFC6 /* AFWKWebViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 323D83E4231D188400C5BFC6 /* AFWKWebViewTests.m */; }; 5F4323BB1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */; }; 5F4323BC1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */; }; 5F4323BD1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */; }; @@ -193,6 +194,18 @@ 5F4323DD1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */; }; 5F4323DE1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */; }; 5F4323DF1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */; }; + E2B10D8E233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8B233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer */; }; + E2B10D8F233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8B233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer */; }; + E2B10D90233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8B233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer */; }; + E2B10D91233035100004E005 /* Amazon Root CA 1.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8C233035100004E005 /* Amazon Root CA 1.cer */; }; + E2B10D92233035100004E005 /* Amazon Root CA 1.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8C233035100004E005 /* Amazon Root CA 1.cer */; }; + E2B10D93233035100004E005 /* Amazon Root CA 1.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8C233035100004E005 /* Amazon Root CA 1.cer */; }; + E2B10D94233035100004E005 /* Amazon.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8D233035100004E005 /* Amazon.cer */; }; + E2B10D95233035100004E005 /* Amazon.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8D233035100004E005 /* Amazon.cer */; }; + E2B10D96233035100004E005 /* Amazon.cer in Resources */ = {isa = PBXBuildFile; fileRef = E2B10D8D233035100004E005 /* Amazon.cer */; }; + E91164651DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */; }; + E91164661DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */; }; + E91164671DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -220,6 +233,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFImageResponseSerializerTests.m; sourceTree = ""; }; + 1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AFCompatibilityMacros.h; sourceTree = ""; }; 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFUIButtonTests.m; sourceTree = ""; }; 297824A01BC2D69A0041C395 /* adn_0.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_0.cer; path = ADNNetServerTrustChain/adn_0.cer; sourceTree = ""; }; 297824A11BC2D69A0041C395 /* adn_1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_1.cer; path = ADNNetServerTrustChain/adn_1.cer; sourceTree = ""; }; @@ -227,11 +242,7 @@ 2987B0A51BC408A200179A4C /* AFNetworking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AFNetworking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2987B0AE1BC408A200179A4C /* AFNetworking tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking tvOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 298D7C3B1BC2C79500FD3B3E /* AFNetworking iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 298D7C4A1BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking Mac OS X Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AddTrust_External_CA_Root.cer; sourceTree = ""; }; - 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Certification_Authority.cer; sourceTree = ""; }; - 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Domain_Validation_Secure_Server_CA.cer; sourceTree = ""; }; - 298D7C711BC2C88F00FD3B3E /* httpbinorg_01162016.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = httpbinorg_01162016.cer; sourceTree = ""; }; + 298D7C4A1BC2C7B200FD3B3E /* AFNetworking macOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking macOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 298D7C771BC2C88F00FD3B3E /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; 298D7C791BC2C88F00FD3B3E /* AltName.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AltName.cer; sourceTree = ""; }; 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = foobar.com.cer; sourceTree = ""; }; @@ -281,7 +292,6 @@ 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIActivityIndicatorView+AFNetworking.m"; sourceTree = ""; }; 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+AFNetworking.h"; sourceTree = ""; }; 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+AFNetworking.m"; sourceTree = ""; }; - 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+AFNetworking.h"; sourceTree = ""; }; 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+AFNetworking.h"; sourceTree = ""; }; 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+AFNetworking.m"; sourceTree = ""; }; 299522951BBF13C700859F49 /* UIKit+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIKit+AFNetworking.h"; sourceTree = ""; }; @@ -289,9 +299,22 @@ 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIProgressView+AFNetworking.m"; sourceTree = ""; }; 299522981BBF13C700859F49 /* UIRefreshControl+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIRefreshControl+AFNetworking.h"; sourceTree = ""; }; 299522991BBF13C700859F49 /* UIRefreshControl+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIRefreshControl+AFNetworking.m"; sourceTree = ""; }; - 2995229A1BBF13C700859F49 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWebView+AFNetworking.h"; sourceTree = ""; }; - 2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWebView+AFNetworking.m"; sourceTree = ""; }; 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFCompoundResponseSerializerTests.m; sourceTree = ""; }; + 2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFXMLParserResponseSerializerTests.m; sourceTree = ""; }; + 2D4563931DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFXMLDocumentResponseSerializerTests.m; sourceTree = ""; }; + 31CBC006242D8DF200934333 /* httpbinorg_02182021.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = httpbinorg_02182021.cer; sourceTree = ""; }; + 323D83E0231D185400C5BFC6 /* WKWebView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WKWebView+AFNetworking.h"; sourceTree = ""; }; + 323D83E1231D185400C5BFC6 /* WKWebView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WKWebView+AFNetworking.m"; sourceTree = ""; }; + 323D83E4231D188400C5BFC6 /* AFWKWebViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFWKWebViewTests.m; sourceTree = ""; }; + 439E280C247E16DE004467ED /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = SOURCE_ROOT; }; + 439E280D247E16DE004467ED /* Gemfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; indentWidth = 2; lineEnding = 0; path = Gemfile; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 439E280E247E16DE004467ED /* Gemfile.lock */ = {isa = PBXFileReference; explicitFileType = text.yaml; fileEncoding = 4; indentWidth = 2; lineEnding = 0; path = Gemfile.lock; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 439E280F247E16DE004467ED /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = SOURCE_ROOT; }; + 439E2810247E16DE004467ED /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; + 439E2811247E16DE004467ED /* AFNetworking.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; indentWidth = 2; lineEnding = 0; path = AFNetworking.podspec; sourceTree = SOURCE_ROOT; tabWidth = 2; }; + 439E2812247E16DE004467ED /* CONTRIBUTING_CH.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING_CH.md; sourceTree = SOURCE_ROOT; }; + 439E2813247E16DE004467ED /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = SOURCE_ROOT; }; + 439E2814247E16DF004467ED /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = SOURCE_ROOT; }; 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Equifax_Secure_Certificate_Authority_Root.cer; sourceTree = ""; }; 5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "GeoTrust_Global_CA-cross.cer"; sourceTree = ""; }; 5F4323B51BF63741003B8749 /* google.com.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = google.com.cer; sourceTree = ""; }; @@ -299,6 +322,10 @@ 5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = GoogleComServerTrustChainPath1; sourceTree = ""; }; 5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = GoogleComServerTrustChainPath2; sourceTree = ""; }; 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GeoTrust_Global_CA_Root.cer; sourceTree = ""; }; + E2B10D8B233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Starfield Services Root Certificate Authority - G2.cer"; sourceTree = ""; }; + E2B10D8C233035100004E005 /* Amazon Root CA 1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Amazon Root CA 1.cer"; sourceTree = ""; }; + E2B10D8D233035100004E005 /* Amazon.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Amazon.cer; sourceTree = ""; }; + E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFPropertyListRequestSerializerTests.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -392,11 +419,11 @@ 298D7C6D1BC2C88F00FD3B3E /* HTTPBin.org */ = { isa = PBXGroup; children = ( + E2B10D8C233035100004E005 /* Amazon Root CA 1.cer */, + E2B10D8D233035100004E005 /* Amazon.cer */, + E2B10D8B233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer */, 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */, - 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */, - 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */, - 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */, - 298D7C711BC2C88F00FD3B3E /* httpbinorg_01162016.cer */, + 31CBC006242D8DF200934333 /* httpbinorg_02182021.cer */, ); path = HTTPBin.org; sourceTree = ""; @@ -425,15 +452,19 @@ 298D7CD11BC2CABE00FD3B3E /* AFNetworking Tests */ = { isa = PBXGroup; children = ( + 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */, 298D7C811BC2C88F00FD3B3E /* AFHTTPRequestSerializationTests.m */, 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */, 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */, + 1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */, 298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */, - 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */, - 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */, 298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */, + E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */, + 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */, 298D7C891BC2C88F00FD3B3E /* AFSecurityPolicyTests.m */, 298D7C8F1BC2C88F00FD3B3E /* AFURLSessionManagerTests.m */, + 2D4563931DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m */, + 2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */, ); name = "AFNetworking Tests"; sourceTree = ""; @@ -445,9 +476,10 @@ 298D7C841BC2C88F00FD3B3E /* AFImageDownloaderTests.m */, 298D7C861BC2C88F00FD3B3E /* AFNetworkActivityManagerTests.m */, 298D7C8C1BC2C88F00FD3B3E /* AFUIActivityIndicatorViewTests.m */, + 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */, 298D7C8D1BC2C88F00FD3B3E /* AFUIImageViewTests.m */, 298D7C8E1BC2C88F00FD3B3E /* AFUIRefreshControlTests.m */, - 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */, + 323D83E4231D188400C5BFC6 /* AFWKWebViewTests.m */, ); name = "AFNetworking UIKit Tests"; sourceTree = ""; @@ -473,7 +505,7 @@ 299522651BBF129200859F49 /* AFNetworking.framework */, 299522771BBF136400859F49 /* AFNetworking.framework */, 298D7C3B1BC2C79500FD3B3E /* AFNetworking iOS Tests.xctest */, - 298D7C4A1BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests.xctest */, + 298D7C4A1BC2C7B200FD3B3E /* AFNetworking macOS Tests.xctest */, 2987B0A51BC408A200179A4C /* AFNetworking.framework */, 2987B0AE1BC408A200179A4C /* AFNetworking tvOS Tests.xctest */, ); @@ -485,6 +517,15 @@ children = ( 2995223C1BBF104D00859F49 /* AFNetworking.h */, 2995223E1BBF104D00859F49 /* Info.plist */, + 439E2811247E16DE004467ED /* AFNetworking.podspec */, + 439E2814247E16DF004467ED /* CHANGELOG.md */, + 439E2812247E16DE004467ED /* CONTRIBUTING_CH.md */, + 439E280F247E16DE004467ED /* CONTRIBUTING.md */, + 439E280D247E16DE004467ED /* Gemfile */, + 439E280E247E16DE004467ED /* Gemfile.lock */, + 439E280C247E16DE004467ED /* LICENSE */, + 439E2813247E16DE004467ED /* Package.swift */, + 439E2810247E16DE004467ED /* README.md */, ); name = "Supporting Files"; path = AFNetworking; @@ -493,6 +534,7 @@ 299522451BBF125A00859F49 /* AFNetworking */ = { isa = PBXGroup; children = ( + 1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */, 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */, 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */, 299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */, @@ -522,7 +564,6 @@ 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */, 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */, 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */, - 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */, 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */, 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */, 299522951BBF13C700859F49 /* UIKit+AFNetworking.h */, @@ -530,8 +571,8 @@ 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */, 299522981BBF13C700859F49 /* UIRefreshControl+AFNetworking.h */, 299522991BBF13C700859F49 /* UIRefreshControl+AFNetworking.m */, - 2995229A1BBF13C700859F49 /* UIWebView+AFNetworking.h */, - 2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */, + 323D83E0231D185400C5BFC6 /* WKWebView+AFNetworking.h */, + 323D83E1231D185400C5BFC6 /* WKWebView+AFNetworking.m */, ); path = "UIKit+AFNetworking"; sourceTree = ""; @@ -565,9 +606,9 @@ 29D96E8D1BCC3D7D00F571A5 /* AFURLSessionManager.h in Headers */, 29D96E941BCC406B00F571A5 /* AFAutoPurgingImageCache.h in Headers */, 29D96E951BCC406B00F571A5 /* AFImageDownloader.h in Headers */, + 1F96D2A7203649580085FC3F /* AFCompatibilityMacros.h in Headers */, 29D96E961BCC406B00F571A5 /* UIActivityIndicatorView+AFNetworking.h in Headers */, 29D96E971BCC406B00F571A5 /* UIButton+AFNetworking.h in Headers */, - 29D96E981BCC406B00F571A5 /* UIImage+AFNetworking.h in Headers */, 29D96E991BCC406B00F571A5 /* UIImageView+AFNetworking.h in Headers */, 29D96E9A1BCC406B00F571A5 /* UIProgressView+AFNetworking.h in Headers */, 29D96E8E1BCC3D7D00F571A5 /* AFNetworking.h in Headers */, @@ -579,7 +620,6 @@ buildActionMask = 2147483647; files = ( 2995225A1BBF125A00859F49 /* AFURLRequestSerialization.h in Headers */, - 299522A81BBF13C700859F49 /* UIImage+AFNetworking.h in Headers */, 299522531BBF125A00859F49 /* AFHTTPSessionManager.h in Headers */, 2995229C1BBF13C700859F49 /* AFAutoPurgingImageCache.h in Headers */, 299522581BBF125A00859F49 /* AFSecurityPolicy.h in Headers */, @@ -587,10 +627,11 @@ 299522A91BBF13C700859F49 /* UIImageView+AFNetworking.h in Headers */, 2995229E1BBF13C700859F49 /* AFImageDownloader.h in Headers */, 2995225E1BBF125A00859F49 /* AFURLSessionManager.h in Headers */, + 323D83E2231D185400C5BFC6 /* WKWebView+AFNetworking.h in Headers */, 2995225C1BBF125A00859F49 /* AFURLResponseSerialization.h in Headers */, 299522A21BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h in Headers */, + 1F96D2A4203649560085FC3F /* AFCompatibilityMacros.h in Headers */, 2995223D1BBF104D00859F49 /* AFNetworking.h in Headers */, - 299522B01BBF13C700859F49 /* UIWebView+AFNetworking.h in Headers */, 299522AC1BBF13C700859F49 /* UIProgressView+AFNetworking.h in Headers */, 299522A61BBF13C700859F49 /* UIButton+AFNetworking.h in Headers */, 299522A01BBF13C700859F49 /* AFNetworkActivityIndicatorManager.h in Headers */, @@ -604,6 +645,7 @@ files = ( 29D96E7A1BCC3D6000F571A5 /* AFHTTPSessionManager.h in Headers */, 29D96E7C1BCC3D6000F571A5 /* AFSecurityPolicy.h in Headers */, + 1F96D2A5203649570085FC3F /* AFCompatibilityMacros.h in Headers */, 29D96E7D1BCC3D6000F571A5 /* AFURLRequestSerialization.h in Headers */, 29D96E7E1BCC3D6000F571A5 /* AFURLResponseSerialization.h in Headers */, 29D96E7F1BCC3D6000F571A5 /* AFURLSessionManager.h in Headers */, @@ -618,6 +660,7 @@ 29D96E811BCC3D7200F571A5 /* AFHTTPSessionManager.h in Headers */, 29D96E821BCC3D7200F571A5 /* AFNetworkReachabilityManager.h in Headers */, 29D96E831BCC3D7200F571A5 /* AFSecurityPolicy.h in Headers */, + 1F96D2A6203649570085FC3F /* AFCompatibilityMacros.h in Headers */, 29D96E841BCC3D7200F571A5 /* AFURLRequestSerialization.h in Headers */, 29D96E851BCC3D7200F571A5 /* AFURLResponseSerialization.h in Headers */, 29D96E861BCC3D7200F571A5 /* AFURLSessionManager.h in Headers */, @@ -682,9 +725,9 @@ productReference = 298D7C3B1BC2C79500FD3B3E /* AFNetworking iOS Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - 298D7C491BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests */ = { + 298D7C491BC2C7B200FD3B3E /* AFNetworking macOS Tests */ = { isa = PBXNativeTarget; - buildConfigurationList = 298D7C521BC2C7B200FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking Mac OS X Tests" */; + buildConfigurationList = 298D7C521BC2C7B200FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking macOS Tests" */; buildPhases = ( 298D7C461BC2C7B200FD3B3E /* Sources */, 298D7C471BC2C7B200FD3B3E /* Frameworks */, @@ -695,9 +738,9 @@ dependencies = ( 298D7C511BC2C7B200FD3B3E /* PBXTargetDependency */, ); - name = "AFNetworking Mac OS X Tests"; + name = "AFNetworking macOS Tests"; productName = "AFNetworking Mac OS X Tests"; - productReference = 298D7C4A1BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests.xctest */; + productReference = 298D7C4A1BC2C7B200FD3B3E /* AFNetworking macOS Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; 299522381BBF104D00859F49 /* AFNetworking iOS */ = { @@ -736,9 +779,9 @@ productReference = 299522651BBF129200859F49 /* AFNetworking.framework */; productType = "com.apple.product-type.framework"; }; - 299522761BBF136400859F49 /* AFNetworking OS X */ = { + 299522761BBF136400859F49 /* AFNetworking macOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 2995227C1BBF136400859F49 /* Build configuration list for PBXNativeTarget "AFNetworking OS X" */; + buildConfigurationList = 2995227C1BBF136400859F49 /* Build configuration list for PBXNativeTarget "AFNetworking macOS" */; buildPhases = ( 299522721BBF136400859F49 /* Sources */, 299522731BBF136400859F49 /* Frameworks */, @@ -749,7 +792,7 @@ ); dependencies = ( ); - name = "AFNetworking OS X"; + name = "AFNetworking macOS"; productName = "AFNetworking OS X"; productReference = 299522771BBF136400859F49 /* AFNetworking.framework */; productType = "com.apple.product-type.framework"; @@ -760,38 +803,46 @@ 299522301BBF104D00859F49 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1140; ORGANIZATIONNAME = AFNetworking; TargetAttributes = { 2987B0A41BC408A200179A4C = { CreatedOnToolsVersion = 7.1; + ProvisioningStyle = Automatic; }; 2987B0AD1BC408A200179A4C = { CreatedOnToolsVersion = 7.1; + ProvisioningStyle = Automatic; }; 298D7C3A1BC2C79500FD3B3E = { CreatedOnToolsVersion = 7.0.1; + ProvisioningStyle = Automatic; }; 298D7C491BC2C7B200FD3B3E = { CreatedOnToolsVersion = 7.0.1; + ProvisioningStyle = Automatic; }; 299522381BBF104D00859F49 = { CreatedOnToolsVersion = 7.0.1; + ProvisioningStyle = Automatic; }; 299522641BBF129200859F49 = { CreatedOnToolsVersion = 7.0.1; + ProvisioningStyle = Automatic; }; 299522761BBF136400859F49 = { CreatedOnToolsVersion = 7.0.1; + ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 299522331BBF104D00859F49 /* Build configuration list for PBXProject "AFNetworking" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 6.3"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 2995222F1BBF104D00859F49; productRefGroup = 2995223A1BBF104D00859F49 /* Products */; @@ -800,10 +851,10 @@ targets = ( 299522381BBF104D00859F49 /* AFNetworking iOS */, 299522641BBF129200859F49 /* AFNetworking watchOS */, - 299522761BBF136400859F49 /* AFNetworking OS X */, + 299522761BBF136400859F49 /* AFNetworking macOS */, 2987B0A41BC408A200179A4C /* AFNetworking tvOS */, 298D7C3A1BC2C79500FD3B3E /* AFNetworking iOS Tests */, - 298D7C491BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests */, + 298D7C491BC2C7B200FD3B3E /* AFNetworking macOS Tests */, 2987B0AD1BC408A200179A4C /* AFNetworking tvOS Tests */, ); }; @@ -823,21 +874,21 @@ files = ( 2987B0DE1BC40AFB00179A4C /* foobar.com.cer in Resources */, 2987B0D61BC40AEC00179A4C /* ADNNetServerTrustChain in Resources */, - 2987B0D91BC40AF300179A4C /* COMODO_RSA_Certification_Authority.cer in Resources */, - 2987B0DB1BC40AF300179A4C /* httpbinorg_01162016.cer in Resources */, + E2B10D90233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */, 2987B0DF1BC40AFB00179A4C /* NoDomains.cer in Resources */, 2987B0D41BC40AE900179A4C /* adn_1.cer in Resources */, 2987B0DD1BC40AFB00179A4C /* AltName.cer in Resources */, 2987B0D71BC40AF000179A4C /* HTTPBinOrgServerTrustChain in Resources */, 2987B0D31BC40AE900179A4C /* adn_0.cer in Resources */, 2987B0DC1BC40AF600179A4C /* logo.png in Resources */, - 2987B0D81BC40AF300179A4C /* AddTrust_External_CA_Root.cer in Resources */, 2987B0D51BC40AE900179A4C /* adn_2.cer in Resources */, - 2987B0DA1BC40AF300179A4C /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */, 5F4323D71BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */, + E2B10D96233035100004E005 /* Amazon.cer in Resources */, 5F4323DB1BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */, 5F4323BD1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */, 5F4323DF1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */, + E2B10D93233035100004E005 /* Amazon Root CA 1.cer in Resources */, + 31CBC009242D8DF200934333 /* httpbinorg_02182021.cer in Resources */, 5F4323C01BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */, 5F4323CF1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */, 5F4323C31BF63741003B8749 /* google.com.cer in Resources */, @@ -848,13 +899,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 298D7CC51BC2CAA200FD3B3E /* AddTrust_External_CA_Root.cer in Resources */, 298D7CBF1BC2CA9D00FD3B3E /* foobar.com.cer in Resources */, 298D7CBA1BC2CA9800FD3B3E /* logo.png in Resources */, - 298D7CC61BC2CAA200FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */, - 298D7CC81BC2CAA200FD3B3E /* httpbinorg_01162016.cer in Resources */, + E2B10D8E233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */, 297824A31BC2D69A0041C395 /* adn_0.cer in Resources */, - 298D7CC71BC2CAA200FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */, 298D7CE31BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain in Resources */, 297824A71BC2D69A0041C395 /* adn_2.cer in Resources */, 297824A51BC2D69A0041C395 /* adn_1.cer in Resources */, @@ -862,9 +910,12 @@ 298D7CE01BC2CB5A00FD3B3E /* ADNNetServerTrustChain in Resources */, 298D7CBE1BC2CA9D00FD3B3E /* AltName.cer in Resources */, 5F4323D51BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */, + E2B10D94233035100004E005 /* Amazon.cer in Resources */, 5F4323D91BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */, 5F4323BB1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */, 5F4323DD1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */, + E2B10D91233035100004E005 /* Amazon Root CA 1.cer in Resources */, + 31CBC007242D8DF200934333 /* httpbinorg_02182021.cer in Resources */, 5F4323BE1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */, 5F4323CD1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */, 5F4323C11BF63741003B8749 /* google.com.cer in Resources */, @@ -875,13 +926,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 298D7CC11BC2CAA100FD3B3E /* AddTrust_External_CA_Root.cer in Resources */, 298D7CBC1BC2CA9C00FD3B3E /* foobar.com.cer in Resources */, 298D7CB91BC2CA9800FD3B3E /* logo.png in Resources */, - 298D7CC21BC2CAA100FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */, - 298D7CC41BC2CAA100FD3B3E /* httpbinorg_01162016.cer in Resources */, + E2B10D8F233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */, 297824A41BC2D69A0041C395 /* adn_0.cer in Resources */, - 298D7CC31BC2CAA100FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */, 298D7CE41BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain in Resources */, 297824A81BC2D69A0041C395 /* adn_2.cer in Resources */, 297824A61BC2D69A0041C395 /* adn_1.cer in Resources */, @@ -889,9 +937,12 @@ 298D7CE11BC2CB5A00FD3B3E /* ADNNetServerTrustChain in Resources */, 298D7CBB1BC2CA9C00FD3B3E /* AltName.cer in Resources */, 5F4323D61BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */, + E2B10D95233035100004E005 /* Amazon.cer in Resources */, 5F4323DA1BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */, 5F4323BC1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */, 5F4323CE1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */, + E2B10D92233035100004E005 /* Amazon Root CA 1.cer in Resources */, + 31CBC008242D8DF200934333 /* httpbinorg_02182021.cer in Resources */, 5F4323DE1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */, 5F4323BF1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */, 5F4323C21BF63741003B8749 /* google.com.cer in Resources */, @@ -951,6 +1002,7 @@ 2987B0E31BC40B0900179A4C /* AFUIActivityIndicatorViewTests.m in Sources */, 2987B0D01BC40A7600179A4C /* AFSecurityPolicyTests.m in Sources */, 2987B0CB1BC40A7600179A4C /* AFHTTPResponseSerializationTests.m in Sources */, + 1BF9F9621C87843300F1F35A /* AFImageResponseSerializerTests.m in Sources */, 2987B0CE1BC40A7600179A4C /* AFNetworkReachabilityManagerTests.m in Sources */, 2987B0E01BC40B0900179A4C /* AFAutoPurgingImageCacheTests.m in Sources */, 2987B0CA1BC40A7600179A4C /* AFHTTPRequestSerializationTests.m in Sources */, @@ -959,6 +1011,8 @@ 2987B0CF1BC40A7600179A4C /* AFPropertyListResponseSerializerTests.m in Sources */, 2987B0D21BC40AD800179A4C /* AFTestCase.m in Sources */, 2987B0CD1BC40A7600179A4C /* AFJSONSerializationTests.m in Sources */, + 2D4563921DB117A200AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */, + E91164671DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -969,9 +1023,11 @@ 29D3413F1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */, 2960BAC31C1B2F1A00BA02F0 /* AFUIButtonTests.m in Sources */, 298D7C961BC2C94400FD3B3E /* AFTestCase.m in Sources */, + E91164651DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m in Sources */, 298D7CB11BC2CA6E00FD3B3E /* AFHTTPRequestSerializationTests.m in Sources */, 297824AE1BC2DBD80041C395 /* AFUIActivityIndicatorViewTests.m in Sources */, 297824AD1BC2DBA40041C395 /* AFNetworkActivityManagerTests.m in Sources */, + 1BF9F9601C87832B00F1F35A /* AFImageResponseSerializerTests.m in Sources */, 298D7CDD1BC2CAF700FD3B3E /* AFSecurityPolicyTests.m in Sources */, 298D7CD31BC2CAE800FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */, 297824B01BC2DC2D0041C395 /* AFUIImageViewTests.m in Sources */, @@ -979,7 +1035,9 @@ 298D7CD91BC2CAF200FD3B3E /* AFNetworkReachabilityManagerTests.m in Sources */, 297824AA1BC2DAD80041C395 /* AFAutoPurgingImageCacheTests.m in Sources */, 298D7C981BC2CA2500FD3B3E /* AFURLSessionManagerTests.m in Sources */, + 323D83E5231D188400C5BFC6 /* AFWKWebViewTests.m in Sources */, 297824AC1BC2DB450041C395 /* AFImageDownloaderTests.m in Sources */, + 2D4563901DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */, 298D7CD51BC2CAEC00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */, 298D7CD71BC2CAEF00FD3B3E /* AFJSONSerializationTests.m in Sources */, 298D7CDB1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */, @@ -993,11 +1051,15 @@ 298D7CD41BC2CAE900FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */, 29D341401C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */, 298D7CB21BC2CA6E00FD3B3E /* AFHTTPRequestSerializationTests.m in Sources */, + E91164661DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m in Sources */, 298D7CDE1BC2CAF800FD3B3E /* AFSecurityPolicyTests.m in Sources */, + 1BF9F9611C87843200F1F35A /* AFImageResponseSerializerTests.m in Sources */, 298D7C971BC2C94500FD3B3E /* AFTestCase.m in Sources */, 298D7CD81BC2CAF000FD3B3E /* AFJSONSerializationTests.m in Sources */, + 2D4563941DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m in Sources */, 298D7CDC1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */, 298D7CD61BC2CAED00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */, + 2D4563911DB117A200AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */, 298D7CDA1BC2CAF300FD3B3E /* AFNetworkReachabilityManagerTests.m in Sources */, 298D7C991BC2CA2600FD3B3E /* AFURLSessionManagerTests.m in Sources */, ); @@ -1011,10 +1073,10 @@ 299522571BBF125A00859F49 /* AFNetworkReachabilityManager.m in Sources */, 299522AF1BBF13C700859F49 /* UIRefreshControl+AFNetworking.m in Sources */, 299522AA1BBF13C700859F49 /* UIImageView+AFNetworking.m in Sources */, - 299522B11BBF13C700859F49 /* UIWebView+AFNetworking.m in Sources */, 299522591BBF125A00859F49 /* AFSecurityPolicy.m in Sources */, 299522A71BBF13C700859F49 /* UIButton+AFNetworking.m in Sources */, 299522541BBF125A00859F49 /* AFHTTPSessionManager.m in Sources */, + 323D83E3231D185400C5BFC6 /* WKWebView+AFNetworking.m in Sources */, 2995225F1BBF125A00859F49 /* AFURLSessionManager.m in Sources */, 2995225B1BBF125A00859F49 /* AFURLRequestSerialization.m in Sources */, 2995229D1BBF13C700859F49 /* AFAutoPurgingImageCache.m in Sources */, @@ -1065,7 +1127,7 @@ }; 298D7C511BC2C7B200FD3B3E /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 299522761BBF136400859F49 /* AFNetworking OS X */; + target = 299522761BBF136400859F49 /* AFNetworking macOS */; targetProxy = 298D7C501BC2C7B200FD3B3E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -1074,108 +1136,140 @@ 2987B0B61BC408A200179A4C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = marker; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = ./Framework/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.AFNetworking; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; 2987B0B71BC408A200179A4C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = bitcode; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = ./Framework/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.AFNetworking; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; 2987B0B81BC408A200179A4C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = ./Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOSTests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; + TARGETED_DEVICE_FAMILY = 3; }; name = Debug; }; 2987B0B91BC408A200179A4C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = ./Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOSTests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; + TARGETED_DEVICE_FAMILY = 3; }; name = Release; }; 298D7C431BC2C79500FD3B3E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; 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.AFNetworking-iOS-Tests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; }; name = Debug; }; 298D7C441BC2C79500FD3B3E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; 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.AFNetworking-iOS-Tests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; }; name = Release; }; 298D7C531BC2C7B200FD3B3E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; INFOPLIST_FILE = ./Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-Mac-OS-X-Tests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = macosx; }; name = Debug; @@ -1183,14 +1277,18 @@ 298D7C541BC2C7B200FD3B3E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = "-"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; INFOPLIST_FILE = ./Tests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-Mac-OS-X-Tests"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = macosx; }; name = Release; @@ -1199,18 +1297,36 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_CODE_COVERAGE = YES; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; @@ -1218,7 +1334,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -1226,14 +1342,28 @@ "DEBUG=1", "$(inherited)", ); + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VALUE = 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; + MARKETING_VERSION = 4.0.1; MODULEMAP_FILE = "$(PROJECT_DIR)/Framework/module.modulemap"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -1242,6 +1372,11 @@ TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WARNING_CFLAGS = ( + "-Wall", + "-Wextra", + "-Wno-unused-parameter", + ); WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; @@ -1250,18 +1385,36 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ENABLE_CODE_COVERAGE = NO; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_ASSIGN_ENUM = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; @@ -1269,16 +1422,30 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VALUE = 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; + MARKETING_VERSION = 4.0.1; MODULEMAP_FILE = "$(PROJECT_DIR)/Framework/module.modulemap"; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; @@ -1287,6 +1454,11 @@ VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; + WARNING_CFLAGS = ( + "-Wall", + "-Wextra", + "-Wno-unused-parameter", + ); WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; @@ -1294,52 +1466,68 @@ 299522421BBF104D00859F49 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = marker; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_WARN_SHADOW = YES; INFOPLIST_FILE = ./Framework/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.AFNetworking; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; 299522431BBF104D00859F49 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = bitcode; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_WARN_SHADOW = YES; INFOPLIST_FILE = ./Framework/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.AFNetworking; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; 2995226B1BBF129200859F49 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = marker; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1348,19 +1536,24 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-watchOS"; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; 2995226C1BBF129200859F49 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = bitcode; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CODE_SIGN_STYLE = Automatic; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1369,61 +1562,64 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-watchOS"; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = watchos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = 4; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; 2995227D1BBF136400859F49 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = marker; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ./Framework/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.AFNetworking; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = macosx; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; 2995227E1BBF136400859F49 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = bitcode; + CLANG_ENABLE_OBJC_WEAK = YES; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; INFOPLIST_FILE = ./Framework/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.AFNetworking; PRODUCT_NAME = AFNetworking; + PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = macosx; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 9.0; - WATCHOS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; @@ -1457,7 +1653,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 298D7C521BC2C7B200FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking Mac OS X Tests" */ = { + 298D7C521BC2C7B200FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking macOS Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( 298D7C531BC2C7B200FD3B3E /* Debug */, @@ -1493,7 +1689,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2995227C1BBF136400859F49 /* Build configuration list for PBXNativeTarget "AFNetworking OS X" */ = { + 2995227C1BBF136400859F49 /* Build configuration list for PBXNativeTarget "AFNetworking macOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 2995227D1BBF136400859F49 /* Debug */, diff --git a/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme b/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme index 2c2dddffda..49d21b1db3 100644 --- a/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme +++ b/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme @@ -1,6 +1,6 @@ + buildForRunning = "NO" + buildForProfiling = "NO" + buildForArchiving = "NO" + buildForAnalyzing = "NO"> + + + + + + + + + + + + + + @@ -52,19 +82,13 @@ BlueprintName = "AFNetworking iOS Tests" ReferencedContainer = "container:AFNetworking.xcodeproj"> + + + + - - - - - - + allowLocationSimulation = "YES" + consoleMode = "1"> - - + + + + @@ -26,31 +26,50 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" + shouldUseLaunchSchemeArgsEnv = "NO" + enableThreadSanitizer = "YES" + enableUBSanitizer = "YES" codeCoverageEnabled = "YES"> - - - - - - + + + + + + + + + + + + + + + + - - diff --git a/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme b/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme index 2c2c46ed84..7f88028922 100644 --- a/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme +++ b/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "NO" + enableThreadSanitizer = "YES" + enableUBSanitizer = "YES"> + + + + + + + + + + + + + + @@ -37,24 +67,19 @@ BlueprintName = "AFNetworking tvOS Tests" ReferencedContainer = "container:AFNetworking.xcodeproj"> + + + + - - - - - - - - + + + + - - - - +#ifndef AFCompatibilityMacros_h +#define AFCompatibilityMacros_h -@interface UIImage (AFNetworking) +#ifdef API_AVAILABLE + #define AF_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__) +#else + #define AF_API_AVAILABLE(...) +#endif // API_AVAILABLE -+ (UIImage*) safeImageWithData:(NSData*)data; +#ifdef API_UNAVAILABLE + #define AF_API_UNAVAILABLE(...) API_UNAVAILABLE(__VA_ARGS__) +#else + #define AF_API_UNAVAILABLE(...) +#endif // API_UNAVAILABLE -@end +#if __has_warning("-Wunguarded-availability-new") + #define AF_CAN_USE_AT_AVAILABLE 1 +#else + #define AF_CAN_USE_AT_AVAILABLE 0 +#endif +#if ((__IPHONE_OS_VERSION_MAX_ALLOWED && __IPHONE_OS_VERSION_MAX_ALLOWED < 100000) || (__MAC_OS_VERSION_MAX_ALLOWED && __MAC_OS_VERSION_MAX_ALLOWED < 101200) ||(__WATCH_OS_MAX_VERSION_ALLOWED && __WATCH_OS_MAX_VERSION_ALLOWED < 30000) ||(__TV_OS_MAX_VERSION_ALLOWED && __TV_OS_MAX_VERSION_ALLOWED < 100000)) + #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 0 +#else + #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 1 #endif + +#endif /* AFCompatibilityMacros_h */ diff --git a/AFNetworking/AFHTTPSessionManager.h b/AFNetworking/AFHTTPSessionManager.h index 55ed92ec52..943fc22df0 100644 --- a/AFNetworking/AFHTTPSessionManager.h +++ b/AFNetworking/AFHTTPSessionManager.h @@ -1,5 +1,5 @@ // AFHTTPSessionManager.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -25,12 +25,6 @@ #endif #import -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV -#import -#else -#import -#endif - #import "AFURLSessionManager.h" /** @@ -40,11 +34,9 @@ Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application. - For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect. - ## Methods to Override - To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`. + To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`. ## Serialization @@ -94,6 +86,15 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; +///------------------------------- +/// @name Managing Security Policy +///------------------------------- + +/** + The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate` can only be applied on a session manager initialized with a secure base URL (i.e. https). Applying a security policy with pinning enabled on an insecure session manager throws an `Invalid Security Policy` exception. + */ +@property (nonatomic, strong) AFSecurityPolicy *securityPolicy; + ///--------------------- /// @name Initialization ///--------------------- @@ -131,164 +132,153 @@ NS_ASSUME_NONNULL_BEGIN /** Creates and runs an `NSURLSessionDataTask` with a `GET` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. + @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - - @see -dataTaskWithRequest:completionHandler: - */ -- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString - parameters:(nullable id)parameters - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; - - -/** - Creates and runs an `NSURLSessionDataTask` with a `GET` request. - - @param URLString The URL string used to create the request URL. - @param parameters The parameters to be encoded according to the client request serializer. - @param progress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: */ - (nullable NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(nullable id)parameters - progress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress + headers:(nullable NSDictionary *)headers + progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString - parameters:(nullable id)parameters - success:(nullable void (^)(NSURLSessionDataTask *task))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; - -/** - Creates and runs an `NSURLSessionDataTask` with a `POST` request. - - @param URLString The URL string used to create the request URL. - @param parameters The parameters to be encoded according to the client request serializer. - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - - @see -dataTaskWithRequest:completionHandler: - */ -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString - parameters:(nullable id)parameters - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `POST` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. - @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param headers The headers appended to the default headers for this request. + @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: */ - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters - progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress + headers:(nullable NSDictionary *)headers + progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - - @see -dataTaskWithRequest:completionHandler: - */ -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString - parameters:(nullable id)parameters - constructingBodyWithBlock:(nullable void (^)(id formData))block - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; - -/** - Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. - - @param URLString The URL string used to create the request URL. - @param parameters The parameters to be encoded according to the client request serializer. - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. - @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. - @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. - @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: */ - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers constructingBodyWithBlock:(nullable void (^)(id formData))block - progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress + progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `PUT` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString - parameters:(nullable id)parameters - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString - parameters:(nullable id)parameters - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. - + @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. - + @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString - parameters:(nullable id)parameters - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates an `NSURLSessionDataTask` with a custom `HTTPMethod` request. + + @param method The HTTPMethod string used to create the request. + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param headers The headers appended to the default headers for this request. + @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: + */ +- (nullable NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress + downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; @end diff --git a/AFNetworking/AFHTTPSessionManager.m b/AFNetworking/AFHTTPSessionManager.m index a28cc6edc5..b4ab5915c3 100644 --- a/AFNetworking/AFHTTPSessionManager.m +++ b/AFNetworking/AFHTTPSessionManager.m @@ -1,5 +1,5 @@ // AFHTTPSessionManager.m -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -98,105 +98,100 @@ - (void)setResponseSerializer:(AFHTTPResponseSerializer *)headers + progress:(nullable void (^)(NSProgress * _Nonnull))downloadProgress + success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure { - + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET" URLString:URLString parameters:parameters + headers:headers uploadProgress:nil downloadProgress:downloadProgress success:success failure:failure]; - + [dataTask resume]; - + return dataTask; } - (NSURLSessionDataTask *)HEAD:(NSString *)URLString - parameters:(id)parameters - success:(void (^)(NSURLSessionDataTask *task))success - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask * _Nonnull))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure { - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) { + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) { if (success) { success(task); } } failure:failure]; - + [dataTask resume]; - + return dataTask; } -- (NSURLSessionDataTask *)POST:(NSString *)URLString - parameters:(id)parameters - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure -{ - return [self POST:URLString parameters:parameters progress:nil success:success failure:failure]; -} - -- (NSURLSessionDataTask *)POST:(NSString *)URLString - parameters:(id)parameters - progress:(void (^)(NSProgress * _Nonnull))uploadProgress - success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success - failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure +- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure { - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure]; - + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters headers:headers uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure]; + [dataTask resume]; - + return dataTask; } - (NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers constructingBodyWithBlock:(nullable void (^)(id _Nonnull))block - success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure -{ - return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure]; -} - -- (NSURLSessionDataTask *)POST:(NSString *)URLString - parameters:(id)parameters - constructingBodyWithBlock:(void (^)(id formData))block progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure + success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure { NSError *serializationError = nil; NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError]; + for (NSString *headerField in headers.keyEnumerator) { + [request setValue:headers[headerField] forHTTPHeaderField:headerField]; + } if (serializationError) { if (failure) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu" dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ failure(nil, serializationError); }); -#pragma clang diagnostic pop } - + return nil; } - + __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { if (error) { if (failure) { @@ -208,66 +203,71 @@ - (NSURLSessionDataTask *)POST:(NSString *)URLString } } }]; - + [task resume]; - + return task; } - (NSURLSessionDataTask *)PUT:(NSString *)URLString - parameters:(id)parameters - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure { - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; - + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure]; + [dataTask resume]; - + return dataTask; } - (NSURLSessionDataTask *)PATCH:(NSString *)URLString - parameters:(id)parameters - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure { - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; - + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure]; + [dataTask resume]; - + return dataTask; } - (NSURLSessionDataTask *)DELETE:(NSString *)URLString - parameters:(id)parameters - success:(void (^)(NSURLSessionDataTask *task, id responseObject))success - failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers + success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure { - NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; - + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure]; + [dataTask resume]; - + return dataTask; } + - (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method URLString:(NSString *)URLString - parameters:(id)parameters + parameters:(nullable id)parameters + headers:(nullable NSDictionary *)headers uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress - success:(void (^)(NSURLSessionDataTask *, id))success - failure:(void (^)(NSURLSessionDataTask *, NSError *))failure + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure { NSError *serializationError = nil; NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError]; + for (NSString *headerField in headers.keyEnumerator) { + [request setValue:headers[headerField] forHTTPHeaderField:headerField]; + } if (serializationError) { if (failure) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu" dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ failure(nil, serializationError); }); -#pragma clang diagnostic pop } return nil; @@ -310,11 +310,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { if (!configuration) { NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"]; if (configurationIdentifier) { -#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100) configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier]; -#else - configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier]; -#endif } } diff --git a/AFNetworking/AFNetworkReachabilityManager.h b/AFNetworking/AFNetworkReachabilityManager.h index 4cf0496d27..21982a0e3c 100644 --- a/AFNetworking/AFNetworkReachabilityManager.h +++ b/AFNetworking/AFNetworkReachabilityManager.h @@ -1,5 +1,5 @@ // AFNetworkReachabilityManager.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability. - See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/) + See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ ) @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. */ @@ -107,6 +107,16 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER; +/** + * Unavailable initializer + */ ++ (instancetype)new NS_UNAVAILABLE; + +/** + * Unavailable initializer + */ +- (instancetype)init NS_UNAVAILABLE; + ///-------------------------------------------------- /// @name Starting & Stopping Reachability Monitoring ///-------------------------------------------------- diff --git a/AFNetworking/AFNetworkReachabilityManager.m b/AFNetworking/AFNetworkReachabilityManager.m index 5fba0f7019..45aeb2f7f7 100644 --- a/AFNetworking/AFNetworkReachabilityManager.m +++ b/AFNetworking/AFNetworkReachabilityManager.m @@ -1,5 +1,5 @@ // AFNetworkReachabilityManager.m -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -32,6 +32,7 @@ NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); +typedef AFNetworkReachabilityManager * (^AFNetworkReachabilityStatusCallback)(AFNetworkReachabilityStatus status); NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) { switch (status) { @@ -78,20 +79,21 @@ static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetwork * a queued notification (for an earlier status condition) is processed after * the later update, resulting in the listener being left in the wrong state. */ -static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block) { +static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusCallback block) { AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); dispatch_async(dispatch_get_main_queue(), ^{ + AFNetworkReachabilityManager *manager = nil; if (block) { - block(status); + manager = block(status); } NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) }; - [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo]; + [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:manager userInfo:userInfo]; }); } static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { - AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info); + AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusCallback)info); } @@ -106,7 +108,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { } @interface AFNetworkReachabilityManager () -@property (readwrite, nonatomic, strong) id networkReachability; +@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability; @property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; @property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; @end @@ -123,24 +125,24 @@ + (instancetype)sharedManager { return _sharedManager; } -#ifndef __clang_analyzer__ + (instancetype)managerForDomain:(NSString *)domain { SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]); AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; + + CFRelease(reachability); return manager; } -#endif -#ifndef __clang_analyzer__ + (instancetype)managerForAddress:(const void *)address { SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address); AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; + CFRelease(reachability); + return manager; } -#endif + (instancetype)manager { @@ -164,19 +166,26 @@ - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability { return nil; } - self.networkReachability = CFBridgingRelease(reachability); + _networkReachability = CFRetain(reachability); self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; return self; } -- (instancetype)init NS_UNAVAILABLE +- (instancetype)init { + @throw [NSException exceptionWithName:NSGenericException + reason:@"`-init` unavailable. Use `-initWithReachability:` instead" + userInfo:nil]; return nil; } - (void)dealloc { [self stopMonitoring]; + + if (_networkReachability != NULL) { + CFRelease(_networkReachability); + } } #pragma mark - @@ -203,24 +212,24 @@ - (void)startMonitoring { } __weak __typeof(self)weakSelf = self; - AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { + AFNetworkReachabilityStatusCallback callback = ^(AFNetworkReachabilityStatus status) { __strong __typeof(weakSelf)strongSelf = weakSelf; strongSelf.networkReachabilityStatus = status; if (strongSelf.networkReachabilityStatusBlock) { strongSelf.networkReachabilityStatusBlock(status); } - + + return strongSelf; }; - id networkReachability = self.networkReachability; SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; - SCNetworkReachabilitySetCallback((__bridge SCNetworkReachabilityRef)networkReachability, AFNetworkReachabilityCallback, &context); - SCNetworkReachabilityScheduleWithRunLoop((__bridge SCNetworkReachabilityRef)networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); + SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); + SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0),^{ SCNetworkReachabilityFlags flags; - if (SCNetworkReachabilityGetFlags((__bridge SCNetworkReachabilityRef)networkReachability, &flags)) { + if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) { AFPostReachabilityStatusChange(flags, callback); } }); @@ -231,7 +240,7 @@ - (void)stopMonitoring { return; } - SCNetworkReachabilityUnscheduleFromRunLoop((__bridge SCNetworkReachabilityRef)self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); + SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); } #pragma mark - diff --git a/AFNetworking/AFSecurityPolicy.h b/AFNetworking/AFSecurityPolicy.h index 90fa2129c3..9b966a5766 100644 --- a/AFNetworking/AFSecurityPolicy.h +++ b/AFNetworking/AFSecurityPolicy.h @@ -1,5 +1,5 @@ // AFSecurityPolicy.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -45,10 +45,10 @@ NS_ASSUME_NONNULL_BEGIN /** The certificates used to evaluate server trust according to the SSL pinning mode. - - By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`. Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. + + @see policyWithPinningMode:withPinnedCertificates: */ @property (nonatomic, strong, nullable) NSSet *pinnedCertificates; @@ -90,10 +90,14 @@ NS_ASSUME_NONNULL_BEGIN /** Creates and returns a security policy with the specified pinning mode. + + Certificates with the `.cer` extension found in the main bundle will be pinned. If you want more control over which certificates are pinned, please use `policyWithPinningMode:withPinnedCertificates:` instead. @param pinningMode The SSL pinning mode. @return A new security policy. + + @see -policyWithPinningMode:withPinnedCertificates: */ + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; @@ -104,7 +108,10 @@ NS_ASSUME_NONNULL_BEGIN @param pinnedCertificates The certificates to pin against. @return A new security policy. - */ + + @see +certificatesInBundle: + @see -pinnedCertificates +*/ + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates; ///------------------------------ diff --git a/AFNetworking/AFSecurityPolicy.m b/AFNetworking/AFSecurityPolicy.m index 3704cca0e1..da199aa3b7 100644 --- a/AFNetworking/AFSecurityPolicy.m +++ b/AFNetworking/AFSecurityPolicy.m @@ -1,5 +1,5 @@ // AFSecurityPolicy.m -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -51,8 +51,6 @@ static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { static id AFPublicKeyForCertificate(NSData *certificate) { id allowedPublicKey = nil; SecCertificateRef allowedCertificate; - SecCertificateRef allowedCertificates[1]; - CFArrayRef tempCertificates = nil; SecPolicyRef policy = nil; SecTrustRef allowedTrust = nil; SecTrustResultType result; @@ -60,12 +58,12 @@ static id AFPublicKeyForCertificate(NSData *certificate) { allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate); __Require_Quiet(allowedCertificate != NULL, _out); - allowedCertificates[0] = allowedCertificate; - tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL); - policy = SecPolicyCreateBasicX509(); - __Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out); + __Require_noErr_Quiet(SecTrustCreateWithCertificates(allowedCertificate, policy, &allowedTrust), _out); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out); +#pragma clang diagnostic pop allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust); @@ -78,10 +76,6 @@ static id AFPublicKeyForCertificate(NSData *certificate) { CFRelease(policy); } - if (tempCertificates) { - CFRelease(tempCertificates); - } - if (allowedCertificate) { CFRelease(allowedCertificate); } @@ -92,7 +86,10 @@ static id AFPublicKeyForCertificate(NSData *certificate) { static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) { BOOL isValid = NO; SecTrustResultType result; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out); +#pragma clang diagnostic pop isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed); @@ -124,10 +121,11 @@ static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) { SecTrustRef trust; __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out); - SecTrustResultType result; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out); - +#pragma clang diagnostic pop [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; _out: @@ -167,17 +165,6 @@ + (NSSet *)certificatesInBundle:(NSBundle *)bundle { return [NSSet setWithSet:certificates]; } -+ (NSSet *)defaultPinnedCertificates { - static NSSet *_defaultPinnedCertificates = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - _defaultPinnedCertificates = [self certificatesInBundle:bundle]; - }); - - return _defaultPinnedCertificates; -} - + (instancetype)defaultPolicy { AFSecurityPolicy *securityPolicy = [[self alloc] init]; securityPolicy.SSLPinningMode = AFSSLPinningModeNone; @@ -186,7 +173,8 @@ + (instancetype)defaultPolicy { } + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode { - return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]]; + NSSet *defaultPinnedCertificates = [self certificatesInBundle:[NSBundle mainBundle]]; + return [self policyWithPinningMode:pinningMode withPinnedCertificates:defaultPinnedCertificates]; } + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates { @@ -256,14 +244,11 @@ - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust if (self.SSLPinningMode == AFSSLPinningModeNone) { return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust); - } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) { + } else if (!self.allowInvalidCertificates && !AFServerTrustIsValid(serverTrust)) { return NO; } switch (self.SSLPinningMode) { - case AFSSLPinningModeNone: - default: - return NO; case AFSSLPinningModeCertificate: { NSMutableArray *pinnedCertificates = [NSMutableArray array]; for (NSData *certificateData in self.pinnedCertificates) { @@ -299,6 +284,9 @@ - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust } return trustedPublicKeyCount > 0; } + + default: + return NO; } return NO; @@ -326,7 +314,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue]; self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))]; - self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))]; + self.pinnedCertificates = [decoder decodeObjectOfClass:[NSSet class] forKey:NSStringFromSelector(@selector(pinnedCertificates))]; return self; } diff --git a/AFNetworking/AFURLRequestSerialization.h b/AFNetworking/AFURLRequestSerialization.h index 134b7dd705..dd7cb457bc 100644 --- a/AFNetworking/AFURLRequestSerialization.h +++ b/AFNetworking/AFURLRequestSerialization.h @@ -1,5 +1,5 @@ // AFURLRequestSerialization.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -30,6 +30,31 @@ NS_ASSUME_NONNULL_BEGIN +/** + Returns a percent-escaped string following RFC 3986 for a query string key or value. + RFC 3986 states that the following characters are "reserved" characters. + - General Delimiters: ":", "#", "[", "]", "@", "?", "/" + - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" + + In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow + query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" + should be percent-escaped in the query string. + + @param string The string to be percent-escaped. + + @return The percent-escaped string. + */ +FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string); + +/** + A helper method to generate encoded url query parameters for appending to the end of a URL. + + @param parameters A dictionary of key/values to be encoded. + + @return A url encoded query string + */ +FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters); + /** The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary. @@ -191,7 +216,7 @@ forHTTPHeaderField:(NSString *)field; @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request. */ -- (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block; +- (void)setQueryStringSerializationWithBlock:(nullable NSString * _Nullable (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block; ///------------------------------- /// @name Creating Request Objects @@ -209,10 +234,10 @@ forHTTPHeaderField:(NSString *)field; @return An `NSMutableURLRequest` object. */ -- (NSMutableURLRequest *)requestWithMethod:(NSString *)method - URLString:(NSString *)URLString - parameters:(nullable id)parameters - error:(NSError * _Nullable __autoreleasing *)error; +- (nullable NSMutableURLRequest *)requestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(nullable id)parameters + error:(NSError * _Nullable __autoreleasing *)error; /** Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 @@ -253,7 +278,7 @@ forHTTPHeaderField:(NSString *)field; #pragma mark - /** - The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`. + The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`. */ @protocol AFMultipartFormData diff --git a/AFNetworking/AFURLRequestSerialization.m b/AFNetworking/AFURLRequestSerialization.m index bbab7c48b9..f1d9ee18a0 100644 --- a/AFNetworking/AFURLRequestSerialization.m +++ b/AFNetworking/AFURLRequestSerialization.m @@ -1,5 +1,5 @@ // AFURLRequestSerialization.m -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -44,7 +44,7 @@ - parameter string: The string to be percent-escaped. - returns: The percent-escaped string. */ -static NSString * AFPercentEscapedStringFromString(NSString *string) { +NSString * AFPercentEscapedStringFromString(NSString *string) { static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4 static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;="; @@ -60,10 +60,7 @@ NSMutableString *escaped = @"".mutableCopy; while (index < string.length) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wgnu" NSUInteger length = MIN(string.length - index, batchSize); -#pragma GCC diagnostic pop NSRange range = NSMakeRange(index, length); // To avoid breaking up character sequences such as 👴🏻👮🏽 @@ -119,7 +116,7 @@ - (NSString *)URLEncodedStringValue { FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary); FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value); -static NSString * AFQueryStringFromParameters(NSDictionary *parameters) { +NSString * AFQueryStringFromParameters(NSDictionary *parameters) { NSMutableArray *mutablePairs = [NSMutableArray array]; for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { [mutablePairs addObject:[pair URLEncodedStringValue]]; @@ -189,6 +186,7 @@ - (NSMutableURLRequest *)requestByFinalizingMultipartFormData; @interface AFHTTPRequestSerializer () @property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths; @property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders; +@property (readwrite, nonatomic, strong) dispatch_queue_t requestHeaderModificationQueue; @property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle; @property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization; @end @@ -208,6 +206,7 @@ - (instancetype)init { self.stringEncoding = NSUTF8StringEncoding; self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary]; + self.requestHeaderModificationQueue = dispatch_queue_create("requestHeaderModificationQueue", DISPATCH_QUEUE_CONCURRENT); // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 NSMutableArray *acceptLanguagesComponents = [NSMutableArray array]; @@ -218,19 +217,17 @@ - (instancetype)init { }]; [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"]; + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 NSString *userAgent = nil; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu" #if TARGET_OS_IOS - // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; +#elif TARGET_OS_TV + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; tvOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; #elif TARGET_OS_WATCH - // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]]; #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]; #endif -#pragma clang diagnostic pop if (userAgent) { if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) { NSMutableString *mutableUserAgent = [userAgent mutableCopy]; @@ -306,17 +303,27 @@ - (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval { #pragma mark - - (NSDictionary *)HTTPRequestHeaders { - return [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders]; + NSDictionary __block *value; + dispatch_sync(self.requestHeaderModificationQueue, ^{ + value = [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders]; + }); + return value; } - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field { - [self.mutableHTTPRequestHeaders setValue:value forKey:field]; + dispatch_barrier_sync(self.requestHeaderModificationQueue, ^{ + [self.mutableHTTPRequestHeaders setValue:value forKey:field]; + }); } - (NSString *)valueForHTTPHeaderField:(NSString *)field { - return [self.mutableHTTPRequestHeaders valueForKey:field]; + NSString __block *value; + dispatch_sync(self.requestHeaderModificationQueue, ^{ + value = [self.mutableHTTPRequestHeaders valueForKey:field]; + }); + return value; } - (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username @@ -328,7 +335,9 @@ - (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username } - (void)clearAuthorizationHeader { - [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"]; + dispatch_barrier_sync(self.requestHeaderModificationQueue, ^{ + [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"]; + }); } #pragma mark - @@ -359,10 +368,8 @@ - (NSMutableURLRequest *)requestWithMethod:(NSString *)method NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url]; mutableRequest.HTTPMethod = method; - for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { - if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) { - [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath]; - } + for (NSString *keyPath in self.mutableObservedChangedKeyPaths) { + [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath]; } mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy]; @@ -500,7 +507,7 @@ - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request } if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { - if (query) { + if (query && query.length > 0) { mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]]; } } else { @@ -560,15 +567,19 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { } - (void)encodeWithCoder:(NSCoder *)coder { - [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))]; - [coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))]; + dispatch_sync(self.requestHeaderModificationQueue, ^{ + [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))]; + }); + [coder encodeObject:@(self.queryStringSerializationStyle) forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init]; - serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone]; + dispatch_sync(self.requestHeaderModificationQueue, ^{ + serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone]; + }); serializer.queryStringSerializationStyle = self.queryStringSerializationStyle; serializer.queryStringSerialization = self.queryStringSerialization; @@ -667,6 +678,11 @@ - (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest return self; } +- (void)setRequest:(NSMutableURLRequest *)request +{ + _request = [request mutableCopy]; +} + - (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name error:(NSError * __autoreleasing *)error @@ -835,14 +851,11 @@ @interface AFMultipartBodyStream () @end @implementation AFMultipartBodyStream -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wimplicit-atomic-properties" #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100) @synthesize delegate; #endif @synthesize streamStatus; @synthesize streamError; -#pragma clang diagnostic pop - (instancetype)initWithStringEncoding:(NSStringEncoding)encoding { self = [super init]; @@ -888,8 +901,6 @@ - (NSInteger)read:(uint8_t *)buffer NSInteger totalNumberOfBytesRead = 0; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu" while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) { if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) { if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) { @@ -910,7 +921,6 @@ - (NSInteger)read:(uint8_t *)buffer } } } -#pragma clang diagnostic pop return totalNumberOfBytesRead; } @@ -1091,8 +1101,6 @@ - (BOOL)hasBytesAvailable { return YES; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcovered-switch-default" switch (self.inputStream.streamStatus) { case NSStreamStatusNotOpen: case NSStreamStatusOpening: @@ -1106,7 +1114,6 @@ - (BOOL)hasBytesAvailable { default: return NO; } -#pragma clang diagnostic pop } - (NSInteger)read:(uint8_t *)buffer @@ -1151,11 +1158,8 @@ - (NSInteger)readData:(NSData *)data intoBuffer:(uint8_t *)buffer maxLength:(NSUInteger)length { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu" NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length)); [data getBytes:buffer range:range]; -#pragma clang diagnostic pop _phaseReadOffset += range.length; @@ -1174,8 +1178,6 @@ - (BOOL)transitionToNextPhase { return YES; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcovered-switch-default" switch (_phase) { case AFEncapsulationBoundaryPhase: _phase = AFHeaderPhase; @@ -1195,7 +1197,6 @@ - (BOOL)transitionToNextPhase { break; } _phaseReadOffset = 0; -#pragma clang diagnostic pop return YES; } @@ -1257,7 +1258,21 @@ - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request [mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; } - [mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]]; + if (![NSJSONSerialization isValidJSONObject:parameters]) { + if (error) { + NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"The `parameters` argument is not valid JSON.", @"AFNetworking", nil)}; + *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo]; + } + return nil; + } + + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]; + + if (!jsonData) { + return nil; + } + + [mutableRequest setHTTPBody:jsonData]; } return mutableRequest; @@ -1279,7 +1294,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; - [coder encodeInteger:self.writingOptions forKey:NSStringFromSelector(@selector(writingOptions))]; + [coder encodeObject:@(self.writingOptions) forKey:NSStringFromSelector(@selector(writingOptions))]; } #pragma mark - NSCopying @@ -1336,7 +1351,13 @@ - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request [mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"]; } - [mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]]; + NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]; + + if (!plistData) { + return nil; + } + + [mutableRequest setHTTPBody:plistData]; } return mutableRequest; @@ -1359,7 +1380,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; - [coder encodeInteger:self.format forKey:NSStringFromSelector(@selector(format))]; + [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))]; [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))]; } diff --git a/AFNetworking/AFURLResponseSerialization.h b/AFNetworking/AFURLResponseSerialization.h index f9e14c69a2..56a4d28ae1 100644 --- a/AFNetworking/AFURLResponseSerialization.h +++ b/AFNetworking/AFURLResponseSerialization.h @@ -1,5 +1,5 @@ // AFURLResponseSerialization.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -24,6 +24,11 @@ NS_ASSUME_NONNULL_BEGIN +/** + Recursively removes `NSNull` values from a JSON object. +*/ +FOUNDATION_EXPORT id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions); + /** The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. @@ -57,11 +62,6 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; -/** - The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default. - */ -@property (nonatomic, assign) NSStringEncoding stringEncoding; - /** Creates and returns a serializer with default configuration. */ @@ -111,6 +111,8 @@ NS_ASSUME_NONNULL_BEGIN - `application/json` - `text/json` - `text/javascript` + + In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the `NSJSONSerialization` documentation for more details. */ @interface AFJSONResponseSerializer : AFHTTPResponseSerializer @@ -166,7 +168,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; /** - Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. + Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSXMLDocument` documentation section "Input and Output Options". `0` by default. */ @property (nonatomic, assign) NSUInteger options; diff --git a/AFNetworking/AFURLResponseSerialization.m b/AFNetworking/AFURLResponseSerialization.m index ef5e334235..2715a1b319 100755 --- a/AFNetworking/AFURLResponseSerialization.m +++ b/AFNetworking/AFURLResponseSerialization.m @@ -1,5 +1,5 @@ // AFURLResponseSerialization.m -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -60,11 +60,13 @@ static BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger co return NO; } -static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) { +id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) { if ([JSONObject isKindOfClass:[NSArray class]]) { NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[(NSArray *)JSONObject count]]; for (id value in (NSArray *)JSONObject) { - [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)]; + if (![value isEqual:[NSNull null]]) { + [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)]; + } } return (readingOptions & NSJSONReadingMutableContainers) ? mutableArray : [NSArray arrayWithArray:mutableArray]; @@ -97,8 +99,6 @@ - (instancetype)init { return nil; } - self.stringEncoding = NSUTF8StringEncoding; - self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; self.acceptableContentTypes = nil; @@ -114,8 +114,10 @@ - (BOOL)validateResponse:(NSHTTPURLResponse *)response BOOL responseIsValid = YES; NSError *validationError = nil; - if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) { - if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]]) { + if ([response isKindOfClass:[NSHTTPURLResponse class]]) { + if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]] && + !([response MIMEType] == nil && [data length] == 0)) { + if ([data length] > 0 && [response URL]) { NSMutableDictionary *mutableUserInfo = [@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]], @@ -180,7 +182,7 @@ - (instancetype)initWithCoder:(NSCoder *)decoder { } self.acceptableStatusCodes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableStatusCodes))]; - self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))]; + self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))]; return self; } @@ -242,46 +244,26 @@ - (id)responseObjectForResponse:(NSURLResponse *)response // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization. // See https://github.com/rails/rails/issues/1742 - NSStringEncoding stringEncoding = self.stringEncoding; - if (response.textEncodingName) { - CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); - if (encoding != kCFStringEncodingInvalidId) { - stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); - } + BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]]; + + if (data.length == 0 || isSpace) { + return nil; } - - id responseObject = nil; + NSError *serializationError = nil; - @autoreleasepool { - NSString *responseString = [[NSString alloc] initWithData:data encoding:stringEncoding]; - if (responseString && ![responseString isEqualToString:@" "]) { - // Workaround for a bug in NSJSONSerialization when Unicode character escape codes are used instead of the actual character - // See http://stackoverflow.com/a/12843465/157142 - data = [responseString dataUsingEncoding:NSUTF8StringEncoding]; - - if (data) { - if ([data length] > 0) { - responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError]; - } else { - return nil; - } - } else { - NSDictionary *userInfo = @{ - NSLocalizedDescriptionKey: NSLocalizedStringFromTable(@"Data failed decoding as a UTF-8 string", @"AFNetworking", nil), - NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Could not decode string: %@", @"AFNetworking", nil), responseString] - }; + + id responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError]; - serializationError = [NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo]; - } + if (!responseObject) + { + if (error) { + *error = AFErrorWithUnderlyingError(serializationError, *error); } + return nil; } - - if (self.removesKeysWithNullValues && responseObject) { - responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions); - } - - if (error) { - *error = AFErrorWithUnderlyingError(serializationError, *error); + + if (self.removesKeysWithNullValues) { + return AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions); } return responseObject; @@ -289,6 +271,10 @@ - (id)responseObjectForResponse:(NSURLResponse *)response #pragma mark - NSSecureCoding ++ (BOOL)supportsSecureCoding { + return YES; +} + - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { @@ -311,7 +297,7 @@ - (void)encodeWithCoder:(NSCoder *)coder { #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { - AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + AFJSONResponseSerializer *serializer = [super copyWithZone:zone]; serializer.readingOptions = self.readingOptions; serializer.removesKeysWithNullValues = self.removesKeysWithNullValues; @@ -401,10 +387,14 @@ - (id)responseObjectForResponse:(NSURLResponse *)response NSError *serializationError = nil; NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError]; - if (error) { - *error = AFErrorWithUnderlyingError(serializationError, *error); + if (!document) + { + if (error) { + *error = AFErrorWithUnderlyingError(serializationError, *error); + } + return nil; } - + return document; } @@ -430,7 +420,7 @@ - (void)encodeWithCoder:(NSCoder *)coder { #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { - AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + AFXMLDocumentResponseSerializer *serializer = [super copyWithZone:zone]; serializer.options = self.options; return serializer; @@ -481,15 +471,20 @@ - (id)responseObjectForResponse:(NSURLResponse *)response } } - id responseObject; - NSError *serializationError = nil; - - if (data) { - responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError]; + if (!data) { + return nil; } - - if (error) { - *error = AFErrorWithUnderlyingError(serializationError, *error); + + NSError *serializationError = nil; + + id responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError]; + + if (!responseObject) + { + if (error) { + *error = AFErrorWithUnderlyingError(serializationError, *error); + } + return nil; } return responseObject; @@ -497,6 +492,10 @@ - (id)responseObjectForResponse:(NSURLResponse *)response #pragma mark - NSSecureCoding ++ (BOOL)supportsSecureCoding { + return YES; +} + - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { @@ -519,7 +518,7 @@ - (void)encodeWithCoder:(NSCoder *)coder { #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { - AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + AFPropertyListResponseSerializer *serializer = [super copyWithZone:zone]; serializer.format = self.format; serializer.readOptions = self.readOptions; @@ -713,6 +712,10 @@ - (id)responseObjectForResponse:(NSURLResponse *)response #pragma mark - NSSecureCoding ++ (BOOL)supportsSecureCoding { + return YES; +} + - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { @@ -745,7 +748,7 @@ - (void)encodeWithCoder:(NSCoder *)coder { #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { - AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + AFImageResponseSerializer *serializer = [super copyWithZone:zone]; #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH serializer.imageScale = self.imageScale; @@ -799,13 +802,18 @@ - (id)responseObjectForResponse:(NSURLResponse *)response #pragma mark - NSSecureCoding ++ (BOOL)supportsSecureCoding { + return YES; +} + - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } - self.responseSerializers = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(responseSerializers))]; + NSSet *classes = [NSSet setWithArray:@[[NSArray class], [AFHTTPResponseSerializer class]]]; + self.responseSerializers = [decoder decodeObjectOfClasses:classes forKey:NSStringFromSelector(@selector(responseSerializers))]; return self; } @@ -819,7 +827,7 @@ - (void)encodeWithCoder:(NSCoder *)coder { #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { - AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + AFCompoundResponseSerializer *serializer = [super copyWithZone:zone]; serializer.responseSerializers = self.responseSerializers; return serializer; diff --git a/AFNetworking/AFURLSessionManager.h b/AFNetworking/AFURLSessionManager.h index be91828489..399f64959b 100644 --- a/AFNetworking/AFURLSessionManager.h +++ b/AFNetworking/AFURLSessionManager.h @@ -1,5 +1,5 @@ // AFURLSessionManager.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -25,6 +25,7 @@ #import "AFURLResponseSerialization.h" #import "AFURLRequestSerialization.h" #import "AFSecurityPolicy.h" +#import "AFCompatibilityMacros.h" #if !TARGET_OS_WATCH #import "AFNetworkReachabilityManager.h" #endif @@ -51,6 +52,7 @@ - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:` - `URLSession:task:didReceiveChallenge:completionHandler:` - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:` + - `URLSession:task:needNewBodyStream:` - `URLSession:task:didCompleteWithError:` ### `NSURLSessionDataDelegate` @@ -63,7 +65,7 @@ ### `NSURLSessionDownloadDelegate` - `URLSession:downloadTask:didFinishDownloadingToURL:` - - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:` + - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:` - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:` If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first. @@ -163,19 +165,6 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, strong, nullable) dispatch_group_t completionGroup; -///--------------------------------- -/// @name Working Around System Bugs -///--------------------------------- - -/** - Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default. - - @bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, AFNetworking will follow Apple's recommendation to try creating the task again. - - @see https://github.com/AFNetworking/AFNetworking/issues/1675 - */ -@property (nonatomic, assign) BOOL attemptsToRecreateUploadTasksForBackgroundSessions; - ///--------------------- /// @name Initialization ///--------------------- @@ -190,11 +179,12 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER; /** - Invalidates the managed session, optionally canceling pending tasks. - - @param cancelPendingTasks Whether or not to cancel pending tasks. + Invalidates the managed session, optionally canceling pending tasks and optionally resets given session. + + @param cancelPendingTasks Whether or not to cancel pending tasks. + @param resetSession Whether or not to reset the session of the manager. */ -- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks; +- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession; ///------------------------- /// @name Running Data Tasks @@ -204,22 +194,13 @@ NS_ASSUME_NONNULL_BEGIN Creates an `NSURLSessionDataTask` with the specified request. @param request The HTTP request for the request. + @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request - completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; - -/** - Creates an `NSURLSessionDataTask` with the specified request. - - @param request The HTTP request for the request. - @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. - @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. - @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. - */ -- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request - uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock - downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock + downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; ///--------------------------- @@ -231,14 +212,14 @@ NS_ASSUME_NONNULL_BEGIN @param request The HTTP request for the request. @param fileURL A URL to the local file to be uploaded. - @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. @see `attemptsToRecreateUploadTasksForBackgroundSessions` */ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL - progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; /** @@ -246,23 +227,23 @@ NS_ASSUME_NONNULL_BEGIN @param request The HTTP request for the request. @param bodyData A data object containing the HTTP body to be uploaded. - @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromData:(nullable NSData *)bodyData - progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; /** Creates an `NSURLSessionUploadTask` with the specified streaming request. @param request The HTTP request for the request. - @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request - progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; ///----------------------------- @@ -273,14 +254,14 @@ NS_ASSUME_NONNULL_BEGIN Creates an `NSURLSessionDownloadTask` with the specified request. @param request The HTTP request for the request. - @param progress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method. */ - (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request - progress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; @@ -288,12 +269,12 @@ NS_ASSUME_NONNULL_BEGIN Creates an `NSURLSessionDownloadTask` with the specified resume data. @param resumeData The data used to resume downloading. - @param progress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. */ - (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData - progress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; @@ -334,6 +315,11 @@ NS_ASSUME_NONNULL_BEGIN Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`. @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. + + @warning Implementing a session authentication challenge handler yourself totally bypasses AFNetworking's security policy defined in `AFSecurityPolicy`. Make sure you fully understand the implications before implementing a custom session authentication challenge handler. If you do not want to bypass AFNetworking's security policy, use `-setAuthenticationChallengeHandler:` instead. + + @see -securityPolicy + @see -setAuthenticationChallengeHandler: */ - (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; @@ -353,14 +339,27 @@ NS_ASSUME_NONNULL_BEGIN @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response. */ -- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; +- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * _Nullable (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; /** Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`. - - @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. - */ -- (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; + + @param authenticationChallengeHandler A block object to be executed when a session task has received a request specific authentication challenge. + + When implementing an authentication challenge handler, you should check the authentication method first (`challenge.protectionSpace.authenticationMethod `) to decide if you want to handle the authentication challenge yourself or if you want AFNetworking to handle it. If you want AFNetworking to handle the authentication challenge, just return `@(NSURLSessionAuthChallengePerformDefaultHandling)`. For example, you certainly want AFNetworking to handle certificate validation (i.e. authentication method == `NSURLAuthenticationMethodServerTrust`) as defined by the security policy. If you want to handle the challenge yourself, you have four options: + + 1. Return `nil` from the authentication challenge handler. You **MUST** call the completion handler with a disposition and credentials yourself. Use this if you need to present a user interface to let the user enter their credentials. + 2. Return an `NSError` object from the authentication challenge handler. You **MUST NOT** call the completion handler when returning an `NSError `. The returned error will be reported in the completion handler of the task. Use this if you need to abort an authentication challenge with a specific error. + 3. Return an `NSURLCredential` object from the authentication challenge handler. You **MUST NOT** call the completion handler when returning an `NSURLCredential`. The returned credentials will be used to fulfil the challenge. Use this when you can get credentials without presenting a user interface. + 4. Return an `NSNumber` object wrapping an `NSURLSessionAuthChallengeDisposition`. Supported values are `@(NSURLSessionAuthChallengePerformDefaultHandling)`, `@(NSURLSessionAuthChallengeCancelAuthenticationChallenge)` and `@(NSURLSessionAuthChallengeRejectProtectionSpace)`. You **MUST NOT** call the completion handler when returning an `NSNumber`. + + If you return anything else from the authentication challenge handler, an exception will be thrown. + + For more information about how URL sessions handle the different types of authentication challenges, see [NSURLSession](https://developer.apple.com/reference/foundation/nsurlsession?language=objc) and [URL Session Programming Guide](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html). + + @see -securityPolicy + */ +- (void)setAuthenticationChallengeHandler:(id (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition , NSURLCredential * _Nullable)))authenticationChallengeHandler; /** Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`. @@ -376,6 +375,14 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block; +/** + Sets a block to be executed when metrics are finalized related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didFinishCollectingMetrics:`. + + @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any metrics that were collected in the process of executing the task. + */ +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +- (void)setTaskDidFinishCollectingMetricsBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * _Nullable metrics))block AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)); +#endif ///------------------------------------------- /// @name Setting Data Task Delegate Callbacks ///------------------------------------------- @@ -409,11 +416,11 @@ NS_ASSUME_NONNULL_BEGIN - (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block; /** - Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`. + Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`. @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session. */ -- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block; +- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block AF_API_UNAVAILABLE(macos); ///----------------------------------------------- /// @name Setting Download Task Delegate Callbacks @@ -427,7 +434,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block; /** - Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`. + Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:`. @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue. */ @@ -466,6 +473,11 @@ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification; */ FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification; +/** + Posted when a session download task finished moving the temporary download file to a specified destination successfully. + */ +FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification; + /** Posted when a session download task encountered an error when moving the temporary download file to a specified destination. */ @@ -496,4 +508,9 @@ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey; */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey; +/** + The session task metrics taken from the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteSessionTaskMetrics` + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSessionTaskMetrics; + NS_ASSUME_NONNULL_END diff --git a/AFNetworking/AFURLSessionManager.m b/AFNetworking/AFURLSessionManager.m index de447aea99..c8b6810ef5 100644 --- a/AFNetworking/AFURLSessionManager.m +++ b/AFNetworking/AFURLSessionManager.m @@ -1,5 +1,5 @@ // AFURLSessionManager.m -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2011–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 @@ -22,33 +22,6 @@ #import "AFURLSessionManager.h" #import -#ifndef NSFoundationVersionNumber_iOS_8_0 -#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug 1140.11 -#else -#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug NSFoundationVersionNumber_iOS_8_0 -#endif - -static dispatch_queue_t url_session_manager_creation_queue() { - static dispatch_queue_t af_url_session_manager_creation_queue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - af_url_session_manager_creation_queue = dispatch_queue_create("com.alamofire.networking.session.manager.creation", DISPATCH_QUEUE_SERIAL); - }); - - return af_url_session_manager_creation_queue; -} - -static void url_session_manager_create_task_safely(dispatch_block_t block) { - if (NSFoundationVersionNumber < NSFoundationVersionNumber_With_Fixed_5871104061079552_bug) { - // Fix of bug - // Open Radar:http://openradar.appspot.com/radar?id=5871104061079552 (status: Fixed in iOS8) - // Issue about:https://github.com/AFNetworking/AFNetworking/issues/2093 - dispatch_sync(url_session_manager_creation_queue(), block); - } else { - block(); - } -} - static dispatch_queue_t url_session_manager_processing_queue() { static dispatch_queue_t af_url_session_manager_processing_queue; static dispatch_once_t onceToken; @@ -73,6 +46,7 @@ static dispatch_group_t url_session_manager_completion_group() { NSString * const AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete"; NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend"; NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate"; +NSString * const AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification = @"com.alamofire.networking.session.download.file-manager-succeed"; NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error"; NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse"; @@ -80,23 +54,24 @@ static dispatch_group_t url_session_manager_completion_group() { NSString * const AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata"; NSString * const AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error"; NSString * const AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath"; +NSString * const AFNetworkingTaskDidCompleteSessionTaskMetrics = @"com.alamofire.networking.complete.sessiontaskmetrics"; static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock"; -static NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3; - -static void * AFTaskStateChangedContext = &AFTaskStateChangedContext; - typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error); typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); typedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request); typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); +typedef id (^AFURLSessionTaskAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential)); typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session); typedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task); typedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); typedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error); +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * metrics) AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)); +#endif typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response); typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask); @@ -110,15 +85,18 @@ static dispatch_group_t url_session_manager_completion_group() { typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error); - #pragma mark - @interface AFURLSessionManagerTaskDelegate : NSObject +- (instancetype)initWithTask:(NSURLSessionTask *)task; @property (nonatomic, weak) AFURLSessionManager *manager; @property (nonatomic, strong) NSMutableData *mutableData; @property (nonatomic, strong) NSProgress *uploadProgress; @property (nonatomic, strong) NSProgress *downloadProgress; @property (nonatomic, copy) NSURL *downloadFileURL; +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +@property (nonatomic, strong) NSURLSessionTaskMetrics *sessionTaskMetrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)); +#endif @property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; @property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock; @property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock; @@ -127,113 +105,56 @@ @interface AFURLSessionManagerTaskDelegate : NSObject *)change context:(void *)context { - if ([object isKindOfClass:[NSURLSessionTask class]]) { - if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { - self.downloadProgress.completedUnitCount = [change[@"new"] longLongValue]; - } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) { - self.downloadProgress.totalUnitCount = [change[@"new"] longLongValue]; - } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { - self.uploadProgress.completedUnitCount = [change[@"new"] longLongValue]; - } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) { - self.uploadProgress.totalUnitCount = [change[@"new"] longLongValue]; - } - } - else if ([object isEqual:self.downloadProgress]) { + if ([object isEqual:self.downloadProgress]) { if (self.downloadProgressBlock) { self.downloadProgressBlock(object); } @@ -245,19 +166,20 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } } +static const void * const AuthenticationChallengeErrorKey = &AuthenticationChallengeErrorKey; + #pragma mark - NSURLSessionTaskDelegate - (void)URLSession:(__unused NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu" + error = objc_getAssociatedObject(task, AuthenticationChallengeErrorKey) ?: error; __strong AFURLSessionManager *manager = self.manager; __block id responseObject = nil; - __block NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; userInfo[AFNetworkingTaskDidCompleteResponseSerializerKey] = manager.responseSerializer; //Performance Improvement from #2672 @@ -268,6 +190,14 @@ - (void)URLSession:(__unused NSURLSession *)session self.mutableData = nil; } +#if AF_CAN_USE_AT_AVAILABLE && AF_CAN_INCLUDE_SESSION_TASK_METRICS + if (@available(iOS 10, macOS 10.12, watchOS 3, tvOS 10, *)) { + if (self.sessionTaskMetrics) { + userInfo[AFNetworkingTaskDidCompleteSessionTaskMetrics] = self.sessionTaskMetrics; + } + } +#endif + if (self.downloadFileURL) { userInfo[AFNetworkingTaskDidCompleteAssetPathKey] = self.downloadFileURL; } else if (data) { @@ -314,34 +244,71 @@ - (void)URLSession:(__unused NSURLSession *)session }); }); } -#pragma clang diagnostic pop } -#pragma mark - NSURLSessionDataTaskDelegate +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)) { + self.sessionTaskMetrics = metrics; +} +#endif + +#pragma mark - NSURLSessionDataDelegate - (void)URLSession:(__unused NSURLSession *)session dataTask:(__unused NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { + self.downloadProgress.totalUnitCount = dataTask.countOfBytesExpectedToReceive; + self.downloadProgress.completedUnitCount = dataTask.countOfBytesReceived; + [self.mutableData appendData:data]; } -#pragma mark - NSURLSessionDownloadTaskDelegate +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task + didSendBodyData:(int64_t)bytesSent + totalBytesSent:(int64_t)totalBytesSent +totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend{ + + self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend; + self.uploadProgress.completedUnitCount = task.countOfBytesSent; +} + +#pragma mark - NSURLSessionDownloadDelegate + +- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask + didWriteData:(int64_t)bytesWritten + totalBytesWritten:(int64_t)totalBytesWritten +totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite{ + + self.downloadProgress.totalUnitCount = totalBytesExpectedToWrite; + self.downloadProgress.completedUnitCount = totalBytesWritten; +} + +- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask + didResumeAtOffset:(int64_t)fileOffset +expectedTotalBytes:(int64_t)expectedTotalBytes{ + + self.downloadProgress.totalUnitCount = expectedTotalBytes; + self.downloadProgress.completedUnitCount = fileOffset; +} - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location { - NSError *fileManagerError = nil; self.downloadFileURL = nil; if (self.downloadTaskDidFinishDownloading) { self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); if (self.downloadFileURL) { - [[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]; + NSError *fileManagerError = nil; - if (fileManagerError) { + if (![[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]) { [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo]; + } else { + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification object:downloadTask userInfo:nil]; } } } @@ -413,7 +380,7 @@ + (void)load { 8) Set the current class to the super class, and repeat steps 3-8 */ NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration]; - NSURLSession * session = [NSURLSession sessionWithConfiguration:configuration]; + NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnonnull" NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil]; @@ -487,12 +454,15 @@ @interface AFURLSessionManager () @property (readwrite, nonatomic, strong) NSLock *lock; @property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid; @property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; -@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession; +@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession AF_API_UNAVAILABLE(macos); @property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection; -@property (readwrite, nonatomic, copy) AFURLSessionTaskDidReceiveAuthenticationChallengeBlock taskDidReceiveAuthenticationChallenge; +@property (readwrite, nonatomic, copy) AFURLSessionTaskAuthenticationChallengeBlock authenticationChallengeHandler; @property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream; @property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData; @property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete; +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidFinishCollectingMetricsBlock taskDidFinishCollectingMetrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)); +#endif @property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse; @property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask; @property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData; @@ -523,8 +493,6 @@ - (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)config self.operationQueue = [[NSOperationQueue alloc] init]; self.operationQueue.maxConcurrentOperationCount = 1; - self.session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue]; - self.responseSerializer = [AFJSONResponseSerializer serializer]; self.securityPolicy = [AFSecurityPolicy defaultPolicy]; @@ -561,6 +529,19 @@ - (void)dealloc { #pragma mark - +- (NSURLSession *)session { + + @synchronized (self) { + if (!_session) { + _session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue]; + } + } + return _session; +} + +#pragma mark - + + - (NSString *)taskDescriptionForSessionTasks { return [NSString stringWithFormat:@"%p", self]; } @@ -608,7 +589,6 @@ - (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate [self.lock lock]; self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate; - [delegate setupProgressForTask:task]; [self addNotificationObserverForTask:task]; [self.lock unlock]; } @@ -618,7 +598,7 @@ - (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { - AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; + AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:dataTask]; delegate.manager = self; delegate.completionHandler = completionHandler; @@ -633,7 +613,7 @@ - (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { - AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; + AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:uploadTask]; delegate.manager = self; delegate.completionHandler = completionHandler; @@ -649,7 +629,7 @@ - (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler { - AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; + AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] initWithTask:downloadTask]; delegate.manager = self; delegate.completionHandler = completionHandler; @@ -669,9 +649,7 @@ - (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask - (void)removeDelegateForTask:(NSURLSessionTask *)task { NSParameterAssert(task); - AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; [self.lock lock]; - [delegate cleanUpProgressForTask:task]; [self removeNotificationObserverForTask:task]; [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)]; [self.lock unlock]; @@ -719,14 +697,15 @@ - (NSArray *)downloadTasks { #pragma mark - -- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks { - dispatch_async(dispatch_get_main_queue(), ^{ - if (cancelPendingTasks) { - [self.session invalidateAndCancel]; - } else { - [self.session finishTasksAndInvalidate]; - } - }); +- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession { + if (cancelPendingTasks) { + [self.session invalidateAndCancel]; + } else { + [self.session finishTasksAndInvalidate]; + } + if (resetSession) { + self.session = nil; + } } #pragma mark - @@ -750,21 +729,12 @@ - (void)removeNotificationObserverForTask:(NSURLSessionTask *)task { #pragma mark - -- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request - completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler -{ - return [self dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:completionHandler]; -} - - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler { - __block NSURLSessionDataTask *dataTask = nil; - url_session_manager_create_task_safely(^{ - dataTask = [self.session dataTaskWithRequest:request]; - }); + NSURLSessionDataTask *dataTask = [self.session dataTaskWithRequest:request]; [self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler]; @@ -778,19 +748,14 @@ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { - __block NSURLSessionUploadTask *uploadTask = nil; - url_session_manager_create_task_safely(^{ - uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; - }); - - if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) { - for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) { - uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; - } + NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; + + if (uploadTask) { + [self addDelegateForUploadTask:uploadTask + progress:uploadProgressBlock + completionHandler:completionHandler]; } - [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; - return uploadTask; } @@ -799,11 +764,8 @@ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { - __block NSURLSessionUploadTask *uploadTask = nil; - url_session_manager_create_task_safely(^{ - uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData]; - }); - + NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData]; + [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; return uploadTask; @@ -813,10 +775,7 @@ - (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)reques progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { - __block NSURLSessionUploadTask *uploadTask = nil; - url_session_manager_create_task_safely(^{ - uploadTask = [self.session uploadTaskWithStreamedRequest:request]; - }); + NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithStreamedRequest:request]; [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; @@ -830,11 +789,8 @@ - (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler { - __block NSURLSessionDownloadTask *downloadTask = nil; - url_session_manager_create_task_safely(^{ - downloadTask = [self.session downloadTaskWithRequest:request]; - }); - + NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithRequest:request]; + [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler]; return downloadTask; @@ -845,10 +801,7 @@ - (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler { - __block NSURLSessionDownloadTask *downloadTask = nil; - url_session_manager_create_task_safely(^{ - downloadTask = [self.session downloadTaskWithResumeData:resumeData]; - }); + NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithResumeData:resumeData]; [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler]; @@ -874,9 +827,11 @@ - (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChalle self.sessionDidReceiveAuthenticationChallenge = block; } +#if !TARGET_OS_OSX - (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block { self.didFinishEventsForBackgroundURLSession = block; } +#endif #pragma mark - @@ -888,10 +843,6 @@ - (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession self.taskWillPerformHTTPRedirection = block; } -- (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { - self.taskDidReceiveAuthenticationChallenge = block; -} - - (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block { self.taskDidSendBodyData = block; } @@ -900,6 +851,12 @@ - (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTas self.taskDidComplete = block; } +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +- (void)setTaskDidFinishCollectingMetricsBlock:(void (^)(NSURLSession * _Nonnull, NSURLSessionTask * _Nonnull, NSURLSessionTaskMetrics * _Nullable))block AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)) { + self.taskDidFinishCollectingMetrics = block; +} +#endif + #pragma mark - - (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block { @@ -939,15 +896,20 @@ - (NSString *)description { } - (BOOL)respondsToSelector:(SEL)selector { - if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) { + if (selector == @selector(URLSession:didReceiveChallenge:completionHandler:)) { + return self.sessionDidReceiveAuthenticationChallenge != nil; + } else if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) { return self.taskWillPerformHTTPRedirection != nil; } else if (selector == @selector(URLSession:dataTask:didReceiveResponse:completionHandler:)) { return self.dataTaskDidReceiveResponse != nil; } else if (selector == @selector(URLSession:dataTask:willCacheResponse:completionHandler:)) { return self.dataTaskWillCacheResponse != nil; - } else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) { + } +#if !TARGET_OS_OSX + else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) { return self.didFinishEventsForBackgroundURLSession != nil; } +#endif return [[self class] instancesRespondToSelector:selector]; } @@ -968,27 +930,10 @@ - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { - NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; - __block NSURLCredential *credential = nil; + NSAssert(self.sessionDidReceiveAuthenticationChallenge != nil, @"`respondsToSelector:` implementation forces `URLSession:didReceiveChallenge:completionHandler:` to be called only if `self.sessionDidReceiveAuthenticationChallenge` is not nil"); - if (self.sessionDidReceiveAuthenticationChallenge) { - disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential); - } else { - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { - credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; - if (credential) { - disposition = NSURLSessionAuthChallengeUseCredential; - } else { - disposition = NSURLSessionAuthChallengePerformDefaultHandling; - } - } else { - disposition = NSURLSessionAuthChallengeRejectProtectionSpace; - } - } else { - disposition = NSURLSessionAuthChallengePerformDefaultHandling; - } - } + NSURLCredential *credential = nil; + NSURLSessionAuthChallengeDisposition disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential); if (completionHandler) { completionHandler(disposition, credential); @@ -1019,21 +964,40 @@ - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { + BOOL evaluateServerTrust = NO; NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; - __block NSURLCredential *credential = nil; + NSURLCredential *credential = nil; - if (self.taskDidReceiveAuthenticationChallenge) { - disposition = self.taskDidReceiveAuthenticationChallenge(session, task, challenge, &credential); + if (self.authenticationChallengeHandler) { + id result = self.authenticationChallengeHandler(session, task, challenge, completionHandler); + if (result == nil) { + return; + } else if ([result isKindOfClass:NSError.class]) { + objc_setAssociatedObject(task, AuthenticationChallengeErrorKey, result, OBJC_ASSOCIATION_RETAIN); + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; + } else if ([result isKindOfClass:NSURLCredential.class]) { + credential = result; + disposition = NSURLSessionAuthChallengeUseCredential; + } else if ([result isKindOfClass:NSNumber.class]) { + disposition = [result integerValue]; + NSAssert(disposition == NSURLSessionAuthChallengePerformDefaultHandling || disposition == NSURLSessionAuthChallengeCancelAuthenticationChallenge || disposition == NSURLSessionAuthChallengeRejectProtectionSpace, @""); + evaluateServerTrust = disposition == NSURLSessionAuthChallengePerformDefaultHandling && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; + } else { + @throw [NSException exceptionWithName:@"Invalid Return Value" reason:@"The return value from the authentication challenge handler must be nil, an NSError, an NSURLCredential or an NSNumber." userInfo:nil]; + } } else { - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { - disposition = NSURLSessionAuthChallengeUseCredential; - credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; - } else { - disposition = NSURLSessionAuthChallengeRejectProtectionSpace; - } + evaluateServerTrust = [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; + } + + if (evaluateServerTrust) { + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { + disposition = NSURLSessionAuthChallengeUseCredential; + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; } else { - disposition = NSURLSessionAuthChallengePerformDefaultHandling; + objc_setAssociatedObject(task, AuthenticationChallengeErrorKey, + [self serverTrustErrorForServerTrust:challenge.protectionSpace.serverTrust url:task.currentRequest.URL], + OBJC_ASSOCIATION_RETAIN); + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; } } @@ -1042,6 +1006,31 @@ - (void)URLSession:(NSURLSession *)session } } +- (nonnull NSError *)serverTrustErrorForServerTrust:(nullable SecTrustRef)serverTrust url:(nullable NSURL *)url +{ + NSBundle *CFNetworkBundle = [NSBundle bundleWithIdentifier:@"com.apple.CFNetwork"]; + NSString *defaultValue = @"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “%@” which could put your confidential information at risk."; + NSString *descriptionFormat = NSLocalizedStringWithDefaultValue(@"Err-1202.w", nil, CFNetworkBundle, defaultValue, @"") ?: defaultValue; + NSString *localizedDescription = [descriptionFormat componentsSeparatedByString:@"%@"].count <= 2 ? [NSString localizedStringWithFormat:descriptionFormat, url.host] : descriptionFormat; + NSMutableDictionary *userInfo = [@{ + NSLocalizedDescriptionKey: localizedDescription + } mutableCopy]; + + if (serverTrust) { + userInfo[NSURLErrorFailingURLPeerTrustErrorKey] = (__bridge id)serverTrust; + } + + if (url) { + userInfo[NSURLErrorFailingURLErrorKey] = url; + + if (url.absoluteString) { + userInfo[NSURLErrorFailingURLStringErrorKey] = url.absoluteString; + } + } + + return [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorServerCertificateUntrusted userInfo:userInfo]; +} + - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler @@ -1067,12 +1056,18 @@ - (void)URLSession:(NSURLSession *)session { int64_t totalUnitCount = totalBytesExpectedToSend; - if(totalUnitCount == NSURLSessionTransferSizeUnknown) { + if (totalUnitCount == NSURLSessionTransferSizeUnknown) { NSString *contentLength = [task.originalRequest valueForHTTPHeaderField:@"Content-Length"]; - if(contentLength) { + if (contentLength) { totalUnitCount = (int64_t) [contentLength longLongValue]; } } + + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; + + if (delegate) { + [delegate URLSession:session task:task didSendBodyData:bytesSent totalBytesSent:totalBytesSent totalBytesExpectedToSend:totalBytesExpectedToSend]; + } if (self.taskDidSendBodyData) { self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount); @@ -1097,6 +1092,23 @@ - (void)URLSession:(NSURLSession *)session } } +#if AF_CAN_INCLUDE_SESSION_TASK_METRICS +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics AF_API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10)) +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; + // Metrics may fire after URLSession:task:didCompleteWithError: is called, delegate may be nil + if (delegate) { + [delegate URLSession:session task:task didFinishCollectingMetrics:metrics]; + } + + if (self.taskDidFinishCollectingMetrics) { + self.taskDidFinishCollectingMetrics(session, task, metrics); + } +} +#endif + #pragma mark - NSURLSessionDataDelegate - (void)URLSession:(NSURLSession *)session @@ -1159,6 +1171,7 @@ - (void)URLSession:(NSURLSession *)session } } +#if !TARGET_OS_OSX - (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session { if (self.didFinishEventsForBackgroundURLSession) { dispatch_async(dispatch_get_main_queue(), ^{ @@ -1166,6 +1179,7 @@ - (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session }); } } +#endif #pragma mark - NSURLSessionDownloadDelegate @@ -1179,9 +1193,11 @@ - (void)URLSession:(NSURLSession *)session if (fileURL) { delegate.downloadFileURL = fileURL; NSError *error = nil; - [[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]; - if (error) { + + if (![[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]) { [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo]; + } else { + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidMoveFileSuccessfullyNotification object:downloadTask userInfo:nil]; } return; @@ -1199,6 +1215,13 @@ - (void)URLSession:(NSURLSession *)session totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite { + + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask]; + + if (delegate) { + [delegate URLSession:session downloadTask:downloadTask didWriteData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite]; + } + if (self.downloadTaskDidWriteData) { self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); } @@ -1209,6 +1232,13 @@ - (void)URLSession:(NSURLSession *)session didResumeAtOffset:(int64_t)fileOffset expectedTotalBytes:(int64_t)expectedTotalBytes { + + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask]; + + if (delegate) { + [delegate URLSession:session downloadTask:downloadTask didResumeAtOffset:fileOffset expectedTotalBytes:expectedTotalBytes]; + } + if (self.downloadTaskDidResume) { self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes); } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ec6eaa09a..f28635b35b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,257 @@ -#Change Log +# Change Log All notable changes to this project will be documented in this file. -`AFNetworking` adheres to [Semantic Versioning](http://semver.org/). +`AFNetworking` adheres to [Semantic Versioning](https://semver.org/). --- +## [4.0.1](https://github.com/AFNetworking/AFNetworking/releases/tag/4.0.1) (04/19/2020) +Release on Sunday, April 19, 2020. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/milestone/20?closed=1). + +#### Updated +* Project templates and integrations. + * Implemented by Kaspik in [#4531](https://github.com/AFNetworking/AFNetworking/pull/4531). +* Various CocoaPods podspec settings. + * Implemented by ElfSundae in [#4528](https://github.com/AFNetworking/AFNetworking/pull/4528), [#4532](https://github.com/AFNetworking/AFNetworking/pull/4532), and [#4533](https://github.com/AFNetworking/AFNetworking/pull/4533). + +#### Fixed +* Crash during authentication delegate method. + * Implemented by Kaspik, ElfSundae, and jshier in [#4542](https://github.com/AFNetworking/AFNetworking/pull/4542), [#4552](https://github.com/AFNetworking/AFNetworking/pull/4552), and [#4553](https://github.com/AFNetworking/AFNetworking/pull/4553). +* SPM integration. + * Implemented by jshier in [#4554](https://github.com/AFNetworking/AFNetworking/pull/4554). +* Improper update instead of replacement of header values. + * Implemented by ElfSundae in [#4550](https://github.com/AFNetworking/AFNetworking/pull/4550). +* Nullability of some methods. + * Implemented by ElfSundae in [#4551](https://github.com/AFNetworking/AFNetworking/pull/4551). +* Typos in CHANGELOG. + * Implemented by ElfSundae in [#4537](https://github.com/AFNetworking/AFNetworking/pull/4537). +* Missing tvOS compatibility for some methods. + * Implemented by ElfSundae in [#4536](https://github.com/AFNetworking/AFNetworking/pull/4536). +* Missing `FOUNDATION_EXPORT` for `AFJSONObjectByRemovingKeysWithNullValues`. + * Implemented by ElfSundae in [#4529](https://github.com/AFNetworking/AFNetworking/pull/4529). + +#### Removed +* Unused UIImage+AFNetworking.h file. + * Implemented by ElfSundae in [#4535](https://github.com/AFNetworking/AFNetworking/pull/4535). + +## [4.0.0](https://github.com/AFNetworking/AFNetworking/releases/tag/4.0.0) (03/29/2020) +Released on Sunday, March 29, 2020. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/milestone/16?closed=1). + +#### Added +* Notificate when a downloaded file has been moved successfully. + * Implemented by xingheng in [#4393](https://github.com/AFNetworking/AFNetworking/pull/4393). +* Specific error for certificate pinning failure. + * Implemented by 0xced in [#3425](https://github.com/AFNetworking/AFNetworking/pull/3425). +* `WKWebView` extensions. + * Implemented by tjanela in [#4439](https://github.com/AFNetworking/AFNetworking/pull/4439). +* Automatic location of certificates in the main bundle for certificate pinning. + * Implemented by 0xced in [#3752](https://github.com/AFNetworking/AFNetworking/pull/3752). +* User-Agent support for tvOS. + * Implemented by ghking in [#4014](https://github.com/AFNetworking/AFNetworking/pull/4014). +* Ability for `AFHTTPSessionManager` to recreate its underlying `NSURLSession`. + * Implemented by Kaspik in [#4256](https://github.com/AFNetworking/AFNetworking/pull/4256). +* Ability to set HTTP headers per request. + * Implemented by stnslw in [#4113](https://github.com/AFNetworking/AFNetworking/pull/4113). +* Ability to capture `NSURLSessionTaskMetrics`. + * Implemented by Caelink in [#4237](https://github.com/AFNetworking/AFNetworking/pull/4237). + +#### Updated +* `dataTaskWithHTTPMethod` to be public. + * Implemented by smartinspereira in [#4007](https://github.com/AFNetworking/AFNetworking/pull/4007). +* Reachability notification to include the instance which issued the notification. + * Implemented by LMsgSendNilSelf in [#4051](https://github.com/AFNetworking/AFNetworking/pull/4051). +* `AFJSONObjectByRemovingKeysWithNullValues` to be public. + * Implemented by ashfurrow in [#4051](https://github.com/AFNetworking/AFNetworking/pull/4051). +* `AFJSONObjectByRemovingKeysWithNullValues` to remove `NSNull` values from `NSArray`s. + * Implemented by ashfurrow in [#4052](https://github.com/AFNetworking/AFNetworking/pull/4052). + +#### Changed +* Automated CI to GitHub Actions. + * Implemented by jshier in [#4523](https://github.com/AFNetworking/AFNetworking/pull/4523). + +#### Fixed +* Explicit `NSSecureCoding` support. + * Implemented by jshier in [#4523](https://github.com/AFNetworking/AFNetworking/pull/4523). +* Deprecated API usage on Catalyst. + * Implemented by jshier in [#4523](https://github.com/AFNetworking/AFNetworking/pull/4523). +* Nullability annotations. + * Implemented by jshier in [#4523](https://github.com/AFNetworking/AFNetworking/pull/4523). +* `AFImageDownloader` to more accurately cancel downloads. + * Implemented by kinarobin in [#4407](https://github.com/AFNetworking/AFNetworking/pull/4407). +* Double KVO notifications in `AFNetworkActivityManager`. + * Implemented by kinarobin in [#4406](https://github.com/AFNetworking/AFNetworking/pull/4406). +* Availability annotations around `NSURLSessionTaskMetrics`. + * Implemented by ElfSundae in [#4516](https://github.com/AFNetworking/AFNetworking/pull/4516). +* Issues with `associated_object` and subclasses. + * Implemented by welcommand in [#3872](https://github.com/AFNetworking/AFNetworking/pull/3872). +* Memory leak in example application. + * Implemented by svoit in [#4196](https://github.com/AFNetworking/AFNetworking/pull/4196). +* Crashes in multithreaded scenarios and `dispatch_barrier`. + * Implemented by streeter in [#4474](https://github.com/AFNetworking/AFNetworking/pull/4474). +* Issues with `NSSecureCoding`. + * Implemented by ElfSudae in [#4409](https://github.com/AFNetworking/AFNetworking/pull/4409). +* Code style issues. + * Implemented by svoit in [#4200](https://github.com/AFNetworking/AFNetworking/pull/4200). +* Race condition in `AFImageDownloader`. + * Implemented by bbeversdorf in [#4246](https://github.com/AFNetworking/AFNetworking/pull/4246). +* Coding style issues. + * Implemented by LeeHongHwa in [#4002](https://github.com/AFNetworking/AFNetworking/pull/4002). + +#### Removed +* Support for iOS < 9, macOS < 10.10. + * Implemented by jshier in [#4523](https://github.com/AFNetworking/AFNetworking/pull/4523). +* All previously deprecated APIs. + * Implemented by jshier in [#4523](https://github.com/AFNetworking/AFNetworking/pull/4523). +* Unnecessary `__block` capture. + * Implemented by kinarobin in [#4526](https://github.com/AFNetworking/AFNetworking/pull/4526). +* Workaround for `NSURLSessionUploadTask` creation on iOS 7. + * Implemented by kinarobin in [#4525](https://github.com/AFNetworking/AFNetworking/pull/4525). +* Workaround for safe `NSURLSessionTask` creation on iOS < 8. + * Implemented by kinarobin in [#4401](https://github.com/AFNetworking/AFNetworking/pull/4401). +* `UIWebView` extensions. + * Implemented by tjanela in [#4439](https://github.com/AFNetworking/AFNetworking/pull/4439). + +--- + +## [3.2.1](https://github.com/AFNetworking/AFNetworking/releases/tag/3.2.1) (05/04/2018) +Released on Friday, May 04, 2018. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.2.1+is%3Aclosed). + +#### Updated +* Xcode 9.3 Support + * Implemented by Jeff Kelley in [#4199](https://github.com/AFNetworking/AFNetworking/pull/4199). +* Update HTTPBin certificates for April 2018. + * Implemented by Jeff Kelley in [#4198](https://github.com/AFNetworking/AFNetworking/pull/4198). + +#### Additional Changes +* Remove conflicting nullable specifier on init + * Implemented by Nick Brook and Jeff Kelley in [#4182](https://github.com/AFNetworking/AFNetworking/pull/4182). +* Use @available if available to silence a warning. + * Implemented by Jeff Kelley in [#4138](https://github.com/AFNetworking/AFNetworking/pull/4138). +* UIImageView+AFNetworking: Prevent stuck state for malformed urlRequest + * Implemented by Adam Duflo and aduflo in [#4131](https://github.com/AFNetworking/AFNetworking/pull/4131). +* add the link for LICENSE + * Implemented by Liao Malin in [#4125](https://github.com/AFNetworking/AFNetworking/pull/4125). +* Fix analyzer warning for upload task creation + * Implemented by Jeff Kelley in [#4122](https://github.com/AFNetworking/AFNetworking/pull/4122). + + +## [3.2.0](https://github.com/AFNetworking/AFNetworking/releases/tag/3.2.0) (12/15/2017) +Released on Friday, December 15, 2017. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.2.0+is%3Aclosed). + +#### Added +* Config `AFImageDownloader` `NSURLCache` and ask `AFImageRequestCache` implementer if an image should be cached + * Implemented by wjehenddher in [#4010](https://github.com/AFNetworking/AFNetworking/pull/4010). +* Add `XMLParser`/`XMLDocument` serializer tests + * Implemented by skyline75489 in [#3753](https://github.com/AFNetworking/AFNetworking/pull/3753). +* Enable custom httpbin URL with `HTTPBIN_BASE_URL` environment variable + * Implemented by 0xced in [#3748](https://github.com/AFNetworking/AFNetworking/pull/3748). +* `AFHTTPSessionManager` now throws exception if SSL pinning mode is set for non https sessions + * Implemented by 0xced in [#3687](https://github.com/AFNetworking/AFNetworking/pull/3687). + +#### Updated +* Update security policy test certificates + * Implemented by SlaunchaMan in [#4103](https://github.com/AFNetworking/AFNetworking/pull/4103). +* Allow return value of HTTP redirection block to be `NULL` + * Implemented by TheDom in [#3975](https://github.com/AFNetworking/AFNetworking/pull/3975). +* Clarify documentation for supported encodings in `AFJSONResponseSerializer` + * Implemented by skyline75489 in [#3750](https://github.com/AFNetworking/AFNetworking/pull/3750). +* Handle Error Pointers according to Cocoa Convention + * Implemented by tclementdev in [#3653](https://github.com/AFNetworking/AFNetworking/pull/3653). +* Updates `AFHTTPSessionManager` documentation to reflect v3.x change + * Implemented by ecaselles in [#3476](https://github.com/AFNetworking/AFNetworking/pull/3476). +* Improved code base to generate fewer warnings when using stricter compiler settings + * Implemented by 0xced in [3431](https://github.com/AFNetworking/AFNetworking/pull/3431). + +#### Changed +* Change “Mac OS X” and “OS X” references to “macOS” + * Implemented by SlaunchaMan in [#4104](https://github.com/AFNetworking/AFNetworking/pull/4104). + +#### Fixed +* Fixed crash around customizing `NSURLCache` size for < iOS 8.2 + * Implemented by kcharwood in [#3735](https://github.com/AFNetworking/AFNetworking/pull/3735). +* Fixed issue where `UIWebView` extension did not preserve all of the request information + * Implemented by skyline75489 in [#3733](https://github.com/AFNetworking/AFNetworking/pull/3733). +* Fixed bug with webview delegate callback + * Implemented by kcharwood in [#3727](https://github.com/AFNetworking/AFNetworking/pull/3727). +* Fixed crash when passing invalid JSON to request serialization + * Implemented by 0xced in [#3719](https://github.com/AFNetworking/AFNetworking/pull/3719). +* Fixed potential KVO crasher for URL Session Task delegates + * Implemented by 0xced in [#3718](https://github.com/AFNetworking/AFNetworking/pull/3718). +* Removed ambiguous array creation in `AFSecurityPolicy` + * Implemented by sgl0v in [#3679](https://github.com/AFNetworking/AFNetworking/pull/3679). +* Fixed issue where `NS_UNAVAILABLE` is not reported for `AFNetworkReachabilityManager` + * Implemented by Microbee23 in [#3649](https://github.com/AFNetworking/AFNetworking/pull/3649). +* Require app extension api only on watchOS + * Implemented by ethansinjin in [#3612](https://github.com/AFNetworking/AFNetworking/pull/3612). +* Remove KVO of progress in favor of using the NSURLSession delegate APIs + * Implemented by coreyfloyd in [#3607](https://github.com/AFNetworking/AFNetworking/pull/3607). +* Fixed an issue where registering a `UIProgessView` to a task that was causing a crash + * Implemented by Starscream27 in [#3604](https://github.com/AFNetworking/AFNetworking/pull/3604). +* Moved `[self didChangeValueForKey:@"currentState"]` into correct scope + * Implemented by chenxin0123 in [#3565](https://github.com/AFNetworking/AFNetworking/pull/3565). +* Fixed issue where response serializers did not inherit super class copying + * Implemented by kcharwood in [#3559](https://github.com/AFNetworking/AFNetworking/pull/3559). +* Fixed crashes due to race conditions with `NSMutableDictionary` access in `AFHTTPRequestSerializer` + * Implemented by alexbird in [#3526](https://github.com/AFNetworking/AFNetworking/pull/3526). +* Updated dash character to improve markdown parsing for license + * Implemented by gemmakbarlow in [#3488](https://github.com/AFNetworking/AFNetworking/pull/3488). + +#### Removed +* Deprecate the unused stringEncoding property of `AFHTTPResponseSerializer` + * Implemented by 0xced in [#3751](https://github.com/AFNetworking/AFNetworking/pull/3751). +* Removed unused `AFTaskStateChangedContext` + * Implemented by yulingtianxia in [#3432](https://github.com/AFNetworking/AFNetworking/pull/3432). + + +## [3.1.0](https://github.com/AFNetworking/AFNetworking/releases/tag/3.1.0) (03/31/2016) +Released on Thursday, March 31, 2016. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.1.0+is%3Aclosed). + +#### Added +* Improved `AFImageResponseSerializer` test coverage + * Implemented by quellish in [#3367](https://github.com/AFNetworking/AFNetworking/pull/3367). +* Exposed `AFQueryStringFromParameters` and `AFPercentEscapedStringFromString` for public use. + * Implemented by Kevin Harwood in [#3160](https://github.com/AFNetworking/AFNetworking/pull/3160). + +#### Updated +* Updated Test Suite to run on Xcode 7.3 + * Implemented by Kevin Harwood in [#3418](https://github.com/AFNetworking/AFNetworking/pull/3418). +* Added white space to URLs in code comment to allow Xcode to properly parse them + * Implemented by Draveness in [#3384](https://github.com/AFNetworking/AFNetworking/pull/3384). +* Updated documentation to match method names and correct compiler warnings + * Implemented by Hakon Hanesand in [#3369](https://github.com/AFNetworking/AFNetworking/pull/3369). +* Use `NSKeyValueChangeNewKey` constant in change dictionary rather than hardcoded string. + * Implemented by Wenbin Zhang in [#3360](https://github.com/AFNetworking/AFNetworking/pull/3360). +* Resolved compiler warnings for documentation errors + * Implemented by Ricardo Santos in [#3336](https://github.com/AFNetworking/AFNetworking/pull/3336). + +#### Changed +* Reverted `NSURLSessionAuthChallengeDisposition` to `NSURLSessionAuthChallengeCancelAuthenticationChallenge` for SSL Pinning + * Implemented by Kevin Harwood in [#3417](https://github.com/AFNetworking/AFNetworking/pull/3417). + +#### Fixed +* Removed trailing question mark in query string if parameters are empty + * Implemented by Kevin Harwood in [#3386](https://github.com/AFNetworking/AFNetworking/pull/3386). +* Fixed crash if bad URL was passed into the image downloader + * Implemented by Christian Wen and Kevin Harwood in [#3385](https://github.com/AFNetworking/AFNetworking/pull/3385). +* Fixed image memory calculation + * Implemented by 周明宇 in [#3344](https://github.com/AFNetworking/AFNetworking/pull/3344). +* Fixed issue where UIButton image downloading called wrong cancel method + * Implemented by duanhong in [#3332](https://github.com/AFNetworking/AFNetworking/pull/3332). +* Fixed image downloading cancellation race condition + * Implemented by Kevin Harwood in [#3325](https://github.com/AFNetworking/AFNetworking/pull/3325). +* Fixed static analyzer warnings on AFNetworkReachabilityManager + * Implemented by Jeff Kelley in [#3315](https://github.com/AFNetworking/AFNetworking/pull/3315). +* Fixed issue where download progress would not be reported in iOS 7 + * Implemented by zwm in [#3294](https://github.com/AFNetworking/AFNetworking/pull/3294). +* Fixed status code 204/205 handling + * Implemented by Kevin Harwood in [#3292](https://github.com/AFNetworking/AFNetworking/pull/3292). +* Fixed crash when passing nil/null for progress in UIWebView extension + * Implemented by Kevin Harwood in [#3289](https://github.com/AFNetworking/AFNetworking/pull/3289). + +#### Removed +* Removed workaround for NSJSONSerialization bug that was fixed in iOS 7 + * Implemented by Cédric Luthi in [#3253](https://github.com/AFNetworking/AFNetworking/pull/3253). + + ## [3.0.4](https://github.com/AFNetworking/AFNetworking/releases/tag/3.0.4) (12/18/2015) Released on Friday, December 18, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.4+is%3Aclosed). @@ -123,7 +371,7 @@ For detailed information about migrating to AFNetworking 3.0.0, please reference * Implemented by Kevin Harwood in [#3034](https://github.com/AFNetworking/AFNetworking/pull/3034). -##[2.6.3](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.3) (11/11/2015) +## [2.6.3](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.3) (11/11/2015) Released on Wednesday, November 11, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.3+is%3Aclosed). #### Fixed @@ -133,7 +381,7 @@ Released on Wednesday, November 11, 2015. All issues associated with this milest * Fixed by [jcayzac](https://github.com/jcayzac) in [#3139](https://github.com/AFNetworking/AFNetworking/pull/3139). -##[2.6.2](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.2) (11/06/2015) +## [2.6.2](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.2) (11/06/2015) Released on Friday, November 06, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.2+is%3Aclosed). ### Important Upgrade Note for Swift @@ -175,10 +423,10 @@ Released on Friday, November 06, 2015. All issues associated with this milestone ## [2.6.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.1) (10-13-2015) Released on Tuesday, October 13th, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.1+is%3Aclosed). -###Future Compatibility Note +### Future Compatibility Note Note that AFNetworking 3.0 will soon be released, and will drop support for all `NSURLConnection` based API's (`AFHTTPRequestOperationManager`, `AFHTTPRequestOperation`, and `AFURLConnectionOperation`. If you have not already migrated to `NSURLSession` based API's, please do so soon. For more information, please see the [3.0 migration guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide). -####Fixed +#### Fixed * Fixed a bug that prevented empty x-www-form-urlencoded bodies. * Fixed by [Julien Cayzac](https://github.com/jcayzac) in [#2868](https://github.com/AFNetworking/AFNetworking/pull/2868). * Fixed bug that prevented AFNetworking from being installed for watchOS via Cocoapods. @@ -203,7 +451,7 @@ Note that AFNetworking 3.0 will soon be released, and will drop support for all ## [2.6.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.0) (08-19-2015) Released on Wednesday, August 19th, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.0+is%3Aclosed). -###Important Upgrade Notes +### Important Upgrade Notes Please note the following API/project changes have been made: * iOS 6 and OS X 10.8 support has been dropped from the project to facilitate support for watchOS 2. The final release supporting iOS 6 and OS X 10.8 is 2.5.4. @@ -213,7 +461,7 @@ Please note the following API/project changes have been made: * Implemented by [Chris Gibbs](https://github.com/chrisgibbs) in [#2771](https://github.com/AFNetworking/AFNetworking/pull/2771). * **Support for App Extension Targets is now baked in using `NS_EXTENSION_UNAVAILABLE_IOS`.** You no longer need to define `AF_APP_EXTENSIONS` in order to include code in a extension target. * Implemented by [bnickel](https://github.com/bnickel) in [#2737](https://github.com/AFNetworking/AFNetworking/pull/2737). -* This release now supports watchOS 2.0, which relys on target conditionals that are only present in Xcode 7 and iOS 9/watchOS 2.0/OS X 10.10. If you install the library using CocoaPods, AFNetworking will define these target conditionals for on older platforms, allowing your code to complile. If you do not use Cocoapods, you will need to add the following code your to PCH file. +* This release now supports watchOS 2.0, which relys on target conditionals that are only present in Xcode 7 and iOS 9/watchOS 2.0/OS X 10.10. If you install the library using CocoaPods, AFNetworking will define these target conditionals for on older platforms, allowing your code to compile. If you do not use Cocoapods, you will need to add the following code your to PCH file. ``` #ifndef TARGET_OS_IOS @@ -230,7 +478,7 @@ Please note the following API/project changes have been made: **Note** that support for `NSURLConnection` based API's will be removed in a future update. If you have not already done so, it is recommended that you transition to the `NSURLSession` APIs in the very near future. -####Added +#### Added * Added watchOS 2.0 support. `AFNetworking` can now be added to watchOS targets using CocoaPods. * Added by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2837](https://github.com/AFNetworking/AFNetworking/issues/2837). * Added nullability annotations to all of the header files to improve Swift interoperability. @@ -240,7 +488,7 @@ Please note the following API/project changes have been made: * Improved memory performance when download large objects. * Fixed by [Gabe Zabrino](https://github.com/gfzabarino) and [Kevin Harwood](https://github.com/Kevin Harwood) in [#2672](https://github.com/AFNetworking/AFNetworking/pull/2672). -####Fixed +#### Fixed * Fixed a crash related for objects that observe notifications but don't properly unregister. * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) and [bnickle](https://github.com/bnickel) in [#2741](https://github.com/AFNetworking/AFNetworking/pull/2741). * Fixed a race condition crash that occured with `AFImageResponseSerialization`. @@ -256,7 +504,7 @@ Please note the following API/project changes have been made: * Fixed potential memory leak in `AFNetworkReachabilityManager`. * Fixed by [Julien Cayzac](https://github.com/jcayzac) in [#2867](https://github.com/AFNetworking/AFNetworking/pull/2867). -####Documentation Improvements +#### Documentation Improvements * Clarified best practices for Reachability per Apple recommendations. * Fixed by [Steven Fisher](https://github.com/tewha) in [#2704](https://github.com/AFNetworking/AFNetworking/pull/2704). * Added `startMonitoring` call to the Reachability section of the README @@ -269,11 +517,11 @@ Please note the following API/project changes have been made: ## [2.5.4](https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.4) (2015-05-14) Released on 2015-05-14. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.5.4+is%3Aclosed). -####Updated +#### Updated * Updated the CI test script to run iOS tests on all versions of iOS that are installed on the build machine. * Updated by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2716](https://github.com/AFNetworking/AFNetworking/pull/2716). -####Fixed +#### Fixed * Fixed an issue where `AFNSURLSessionTaskDidResumeNotification` and `AFNSURLSessionTaskDidSuspendNotification` were not being properly called due to implementation differences in `NSURLSessionTask` in iOS 7 and iOS 8, which also affects the `AFNetworkActivityIndicatorManager`. * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2702](https://github.com/AFNetworking/AFNetworking/pull/2702). @@ -1015,7 +1263,7 @@ calls (Mindaugas Vaičiūnas) * Update files to remove executable privilege (Kyle Fuller) -## 2.0.1 (2013-10-10) +## [2.0.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.0.1) (2013-10-10) * Fix iOS 6 compatibility (Matt Baker, Mattt Thompson) @@ -1719,7 +1967,7 @@ Steven Fisher) renamed to `numberOfFinishedOperations` (Mattt Thompson) -## 0.10.0 / 2012-06-26 +## [0.10.0](https://github.com/AFNetworking/AFNetworking/releases/tag/0.10.0) / 2012-06-26 * Add Twitter Mac Example application (Mattt Thompson) @@ -1784,7 +2032,7 @@ renamed to `numberOfFinishedOperations` (Mattt Thompson) * Fix AFHTTPClient to not add unnecessary data when constructing multipart form request with nil parameters (Taeho Kim) -## 1.0RC1 / 2012-04-25 +## [1.0RC1](https://github.com/AFNetworking/AFNetworking/releases/tag/1.0RC1) / 2012-04-25 * Add `AFHTTPRequestOperation +addAcceptableStatusCodes / +addAcceptableContentTypes` to dynamically add acceptable status codes and @@ -1804,7 +2052,7 @@ Mattt Thompson) distinction between WWan and WiFi reachability (Kevin Harwood, Mattt Thompson) -## 0.9.2 / 2012-04-25 +## [0.9.2](https://github.com/AFNetworking/AFNetworking/releases/tag/0.9.2) / 2012-04-25 * Add thread safety to `AFNetworkActivityIndicator` (Peter Steinberger, Mattt Thompson) @@ -1849,7 +2097,7 @@ Mattt Thompson) * Remove @try-@catch block wrapping network thread entry point (Charles T. Ahn) -## 0.9.1 / 2012-03-19 +## [0.9.1](https://github.com/AFNetworking/AFNetworking/releases/tag/0.9.1) / 2012-03-19 * Create Twitter example application (Mattt Thompson) @@ -1907,7 +2155,7 @@ where % is used as a literal rather than as part of a percent escape code `AFImageRequestOperation` (Michael Schneider) -## 0.9.0 / 2012-01-23 +## [0.9.0](https://github.com/AFNetworking/AFNetworking/releases/tag/0.9.0) / 2012-01-23 * Add thread-safe behavior to `AFURLConnectionOperation` (Mattt Thompson) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5de3be7f24..9bb98ead1f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,7 @@ Please read it before you start participating. * [Asking Questions](#asking-questions) * [Reporting Security Issues](#reporting-security-issues) * [Reporting Issues](#reporting-other-issues) +* [Submitting Pull Requests](#submitting-pull-requests) * [Developers Certificate of Origin](#developers-certificate-of-origin) * [Code of Conduct](#code-of-conduct) @@ -52,6 +53,10 @@ When reporting issues, please include the following: This information will help us review and fix your issue faster. +## Submitting Pull Requests + +Pull requests are welcome, and greatly encouraged. When submitting a pull request, please create proper test cases demonstrating the issue to be fixed or the new feature. + ## Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: diff --git a/CONTRIBUTING_CH.md b/CONTRIBUTING_CH.md new file mode 100644 index 0000000000..165da75a47 --- /dev/null +++ b/CONTRIBUTING_CH.md @@ -0,0 +1,97 @@ +# 贡献指南 +本文档包含有关为此项目做出贡献的信息和指南。 +请在开始参加之前阅读。 + +**主题** + +* [提问](#提问) +* [报告安全问题](#报告安全问题) +* [报告其他问题](#报告其他问题) +* [提交拉取请求](#提交拉取请求) +* [开发人员原产地证书](#开发人员原产地证书-1.1) +* [行为守则](#行为守则) + +## 提问 + +我们不使用GitHub的论坛发表问题 +对于任何非特定于项目本身的使用问题, +请直接在[Stack Overflow](https://stackoverflow.com)上询问。 +通过此方法,你可以快速解决您的问题, +并且任何有相同问题的人可以找到答案。 +这也使维护人员能够专注于为其他人改进项目。 + +## 报告安全问题 + +Alamofire Software Foundation 认真对待安全问题。 +如果您发现任何关于安全的问题,请立即通知我们! + +请**不要**公然公开发布问题, +而是将您的问题私下发送到。 +这将有于帮助确保发现的任何漏洞 +可以[披露制度](http://en.wikipedia.org/wiki/Responsible_disclosure) +对任何受影响的各方 + +## 报告其他问题 + +为此项目贡献的方法 +是当遇到问题时,请发送一篇详细的错误报告。 +我们会感谢您写出的一份精心编写的详尽错误报告。 + +在提交问题之前,请检查项目里的问题数据库是否已存在此问题。 +如果您找到匹配项,请添加“+1”或“我也遇到此问题”。 +这样做有助于确定最常见问题和请求的优先级。 + +报告问题时,请包含以下内容: + +* 您正在使用的Xcode版本 +* 您的iOS或OS X版本 +* 任何堆栈轨迹或编译器错误的完整输出 +* 如果代码段可再现所描述的行为 +* 任何其他有助于理解问题的细节 + +此信息有助于我们更快地查看和修复您的问题。 + +## 提交拉取请求 + +大力鼓励和欢迎拉取请求。在提交拉取请求时,请创建适当的测试用例,说明修复的问题或新功能。 + +## 开发人员原产地证书 1.1 + +为了项目做出贡献,我保证: + +- (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +- (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +- (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +- (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## 行为守则 + +该项目采取贡献者公约为准则。 + +这项目的成果将会被我们的行为或行动影响。 + +我们期望每个为此项目做出贡献的人都会对此表示敬意。 + +详情请阅读 [CONDUCT.md](https://github.com/Alamofire/Foundation/blob/master/CONDUCT.md)。 + +---- + +*上述陈述的一些想法和措辞是基于 [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) 和 [Linux](http://elinux.org/Developer_Certificate_Of_Origin) 社区. +我们表彰和感激他们为促进项目合作所做的付出。* diff --git a/Example/AFNetworking Example.xcodeproj/project.pbxproj b/Example/AFNetworking Example.xcodeproj/project.pbxproj index 565c18394f..65b44131f8 100644 --- a/Example/AFNetworking Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking Example.xcodeproj/project.pbxproj @@ -38,7 +38,7 @@ 29E6F1E91BB9E37200A4466C /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29E6F1E81BB9E37200A4466C /* NotificationCenter.framework */; }; 29E6F1ED1BB9E37200A4466C /* TodayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E6F1EC1BB9E37200A4466C /* TodayViewController.m */; }; 29E6F1F01BB9E37200A4466C /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 29E6F1EE1BB9E37200A4466C /* MainInterface.storyboard */; }; - 29E6F1F41BB9E37200A4466C /* Today Extension Example.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 29E6F1E61BB9E37200A4466C /* Today Extension Example.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 29E6F1F41BB9E37200A4466C /* iOS Today Extension Example.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 29E6F1E61BB9E37200A4466C /* iOS Today Extension Example.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 29E6F1F91BB9E56200A4466C /* Post.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E6F19A1BB9DD7300A4466C /* Post.m */; }; 29E6F1FA1BB9E56500A4466C /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = 29E6F19C1BB9DD7300A4466C /* User.m */; }; C2BFE0251C11870800BB258D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C2BFE0241C11870800BB258D /* AppDelegate.m */; }; @@ -87,7 +87,7 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( - 29E6F1F41BB9E37200A4466C /* Today Extension Example.appex in Embed App Extensions */, + 29E6F1F41BB9E37200A4466C /* iOS Today Extension Example.appex in Embed App Extensions */, ); name = "Embed App Extensions"; runOnlyForDeploymentPostprocessing = 0; @@ -108,7 +108,7 @@ /* Begin PBXFileReference section */ 291BFDB91BB9E85400FFB029 /* watchOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "watchOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 291BFDC51BB9E85500FFB029 /* watchOS Example Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "watchOS Example Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; - 291BFDE71BB9E8C700FFB029 /* OS X Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "OS X Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 291BFDE71BB9E8C700FFB029 /* macOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "macOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 291BFDED1BB9E8C700FFB029 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 291BFDF21BB9E8C700FFB029 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 291BFDF71BB9E8C700FFB029 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -137,7 +137,7 @@ 29E6F19F1BB9DD7300A4466C /* AFAppDotNetAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFAppDotNetAPIClient.m; sourceTree = ""; }; 29E6F1AB1BB9DDB600A4466C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29E6F1E01BB9E03600A4466C /* Launchscreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Launchscreen.storyboard; path = "iOS Example/Launchscreen.storyboard"; sourceTree = SOURCE_ROOT; }; - 29E6F1E61BB9E37200A4466C /* Today Extension Example.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Today Extension Example.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + 29E6F1E61BB9E37200A4466C /* iOS Today Extension Example.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "iOS Today Extension Example.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 29E6F1E81BB9E37200A4466C /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 29E6F1EB1BB9E37200A4466C /* TodayViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TodayViewController.h; sourceTree = ""; }; 29E6F1EC1BB9E37200A4466C /* TodayViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TodayViewController.m; sourceTree = ""; }; @@ -205,7 +205,7 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 291BFDE81BB9E8C700FFB029 /* OS X Example */ = { + 291BFDE81BB9E8C700FFB029 /* macOS Example */ = { isa = PBXGroup; children = ( C2BFE0231C11870800BB258D /* AppDelegate.h */, @@ -215,7 +215,7 @@ 291BFDF71BB9E8C700FFB029 /* Info.plist */, 291BFDEC1BB9E8C700FFB029 /* Supporting Files */, ); - path = "OS X Example"; + path = "macOS Example"; sourceTree = ""; }; 291BFDEC1BB9E8C700FFB029 /* Supporting Files */ = { @@ -267,7 +267,7 @@ 29E6F1EA1BB9E37200A4466C /* Today Extension Example */, 29E6F20F1BB9E76A00A4466C /* watchOS Example */, 29E6F21E1BB9E76A00A4466C /* watchOS Example Extension */, - 291BFDE81BB9E8C700FFB029 /* OS X Example */, + 291BFDE81BB9E8C700FFB029 /* macOS Example */, 291BFE161BB9ECEE00FFB029 /* tvOS Example */, 29E6F1E71BB9E37200A4466C /* Frameworks */, 29E6F1761BB9DCB500A4466C /* Products */, @@ -281,10 +281,10 @@ isa = PBXGroup; children = ( 29E6F1751BB9DCB500A4466C /* iOS Example.app */, - 29E6F1E61BB9E37200A4466C /* Today Extension Example.appex */, + 29E6F1E61BB9E37200A4466C /* iOS Today Extension Example.appex */, 291BFDB91BB9E85400FFB029 /* watchOS Example.app */, 291BFDC51BB9E85500FFB029 /* watchOS Example Extension.appex */, - 291BFDE71BB9E8C700FFB029 /* OS X Example.app */, + 291BFDE71BB9E8C700FFB029 /* macOS Example.app */, 291BFE151BB9ECEE00FFB029 /* tvOS Example.app */, ); name = Products; @@ -422,9 +422,9 @@ productReference = 291BFDC51BB9E85500FFB029 /* watchOS Example Extension.appex */; productType = "com.apple.product-type.watchkit2-extension"; }; - 291BFDE61BB9E8C700FFB029 /* OS X Example */ = { + 291BFDE61BB9E8C700FFB029 /* macOS Example */ = { isa = PBXNativeTarget; - buildConfigurationList = 291BFDF81BB9E8C700FFB029 /* Build configuration list for PBXNativeTarget "OS X Example" */; + buildConfigurationList = 291BFDF81BB9E8C700FFB029 /* Build configuration list for PBXNativeTarget "macOS Example" */; buildPhases = ( 291BFDE31BB9E8C700FFB029 /* Sources */, 291BFDE41BB9E8C700FFB029 /* Frameworks */, @@ -434,9 +434,9 @@ ); dependencies = ( ); - name = "OS X Example"; + name = "macOS Example"; productName = "OS X Example"; - productReference = 291BFDE71BB9E8C700FFB029 /* OS X Example.app */; + productReference = 291BFDE71BB9E8C700FFB029 /* macOS Example.app */; productType = "com.apple.product-type.application"; }; 291BFE141BB9ECEE00FFB029 /* tvOS Example */ = { @@ -477,9 +477,9 @@ productReference = 29E6F1751BB9DCB500A4466C /* iOS Example.app */; productType = "com.apple.product-type.application"; }; - 29E6F1E51BB9E37200A4466C /* Today Extension Example */ = { + 29E6F1E51BB9E37200A4466C /* iOS Today Extension Example */ = { isa = PBXNativeTarget; - buildConfigurationList = 29E6F1F51BB9E37200A4466C /* Build configuration list for PBXNativeTarget "Today Extension Example" */; + buildConfigurationList = 29E6F1F51BB9E37200A4466C /* Build configuration list for PBXNativeTarget "iOS Today Extension Example" */; buildPhases = ( 29E6F1E21BB9E37200A4466C /* Sources */, 29E6F1E31BB9E37200A4466C /* Frameworks */, @@ -489,9 +489,9 @@ ); dependencies = ( ); - name = "Today Extension Example"; + name = "iOS Today Extension Example"; productName = "Today Extension Example"; - productReference = 29E6F1E61BB9E37200A4466C /* Today Extension Example.appex */; + productReference = 29E6F1E61BB9E37200A4466C /* iOS Today Extension Example.appex */; productType = "com.apple.product-type.app-extension"; }; /* End PBXNativeTarget section */ @@ -500,7 +500,7 @@ 29E6F16B1BB9DA2E00A4466C /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0710; + LastUpgradeCheck = 1200; TargetAttributes = { 291BFDB81BB9E85400FFB029 = { CreatedOnToolsVersion = 7.1; @@ -513,6 +513,7 @@ }; 291BFE141BB9ECEE00FFB029 = { CreatedOnToolsVersion = 7.1; + LastSwiftMigration = 0800; }; 29E6F1741BB9DCB500A4466C = { CreatedOnToolsVersion = 7.1; @@ -524,7 +525,7 @@ }; buildConfigurationList = 29E6F16E1BB9DA2E00A4466C /* Build configuration list for PBXProject "AFNetworking Example" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -536,10 +537,10 @@ projectRoot = ""; targets = ( 29E6F1741BB9DCB500A4466C /* iOS Example */, - 29E6F1E51BB9E37200A4466C /* Today Extension Example */, + 29E6F1E51BB9E37200A4466C /* iOS Today Extension Example */, 291BFDB81BB9E85400FFB029 /* watchOS Example */, 291BFDC41BB9E85500FFB029 /* watchOS Example Extension */, - 291BFDE61BB9E8C700FFB029 /* OS X Example */, + 291BFDE61BB9E8C700FFB029 /* macOS Example */, 291BFE141BB9ECEE00FFB029 /* tvOS Example */, ); }; @@ -667,7 +668,7 @@ }; 29E6F1F31BB9E37200A4466C /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 29E6F1E51BB9E37200A4466C /* Today Extension Example */; + target = 29E6F1E51BB9E37200A4466C /* iOS Today Extension Example */; targetProxy = 29E6F1F21BB9E37200A4466C /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -708,6 +709,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -756,6 +758,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -799,6 +802,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -848,6 +852,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -891,6 +896,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -920,12 +926,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "OS X Example/Info.plist"; + INFOPLIST_FILE = "macOS Example/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.OS-X-Example"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.macOS-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; @@ -940,6 +946,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -963,11 +970,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "OS X Example/Info.plist"; + INFOPLIST_FILE = "macOS Example/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.OS-X-Example"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.macOS-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; }; @@ -983,6 +990,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -1019,6 +1027,7 @@ SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -1034,6 +1043,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -1062,6 +1072,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -1071,12 +1082,68 @@ 29E6F16F1BB9DA2E00A4466C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; }; name = Debug; }; 29E6F1701BB9DA2E00A4466C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -1089,6 +1156,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -1100,6 +1168,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1118,7 +1187,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "$(PROJECT_DIR)/iOS Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -1137,6 +1206,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -1148,6 +1218,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -1160,7 +1231,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "$(PROJECT_DIR)/iOS Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.iOS-Example"; @@ -1178,6 +1249,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -1226,6 +1298,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -1281,7 +1354,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 291BFDF81BB9E8C700FFB029 /* Build configuration list for PBXNativeTarget "OS X Example" */ = { + 291BFDF81BB9E8C700FFB029 /* Build configuration list for PBXNativeTarget "macOS Example" */ = { isa = XCConfigurationList; buildConfigurations = ( 291BFDF91BB9E8C700FFB029 /* Debug */, @@ -1317,7 +1390,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 29E6F1F51BB9E37200A4466C /* Build configuration list for PBXNativeTarget "Today Extension Example" */ = { + 29E6F1F51BB9E37200A4466C /* Build configuration list for PBXNativeTarget "iOS Today Extension Example" */ = { isa = XCConfigurationList; buildConfigurations = ( 29E6F1F61BB9E37200A4466C /* Debug */, diff --git a/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme b/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme index dc9935e78b..58d9b02931 100644 --- a/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme +++ b/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme @@ -1,6 +1,6 @@ - - + shouldUseLaunchSchemeArgsEnv = "YES" + enableThreadSanitizer = "YES" + enableUBSanitizer = "YES"> + + + + + + + + - - @@ -56,8 +56,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + + + + + - - @@ -29,8 +29,8 @@ @@ -41,24 +41,34 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + + + + + + + diff --git a/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme b/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme index d94ffb6836..4421acd8d7 100644 --- a/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme +++ b/Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme @@ -1,6 +1,6 @@ @@ -41,8 +41,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + + + + + + + - - - - + + - - - - - + - + + + - - - - - + - + diff --git a/Example/AFNetworking tvOS Example.xcodeproj/project.pbxproj b/Example/AFNetworking tvOS Example.xcodeproj/project.pbxproj index bb24710065..a2ecb47cb1 100644 --- a/Example/AFNetworking tvOS Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking tvOS Example.xcodeproj/project.pbxproj @@ -237,6 +237,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -390,6 +391,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -405,6 +407,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOS-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h"; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json index 1b34a14fad..327aae2ab6 100644 --- a/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -2,79 +2,110 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", "scale" : "2x", - "filename" : "Icon-Small@2x.png" + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", "scale" : "3x", - "filename" : "Icon-Small@3x.png" + "size" : "20x20" }, { + "filename" : "Icon-Small@2x.png", "idiom" : "iphone", - "size" : "40x40", "scale" : "2x", - "filename" : "Icon-40@2x.png" + "size" : "29x29" }, { + "filename" : "Icon-Small@3x.png", "idiom" : "iphone", - "size" : "40x40", "scale" : "3x", - "filename" : "Icon-40@3x.png" + "size" : "29x29" }, { + "filename" : "Icon-40@2x.png", "idiom" : "iphone", - "size" : "60x60", "scale" : "2x", - "filename" : "Icon-60@2x.png" + "size" : "40x40" }, { + "filename" : "Icon-40@3x.png", "idiom" : "iphone", - "size" : "60x60", "scale" : "3x", - "filename" : "Icon-60@3x.png" + "size" : "40x40" + }, + { + "filename" : "Icon-60@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "Icon-60@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" }, { "idiom" : "ipad", - "size" : "29x29", "scale" : "1x", - "filename" : "Icon-Small.png" + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "29x29", "scale" : "2x", - "filename" : "Icon-Small@2x.png" + "size" : "20x20" }, { + "filename" : "Icon-Small.png", "idiom" : "ipad", - "size" : "40x40", "scale" : "1x", - "filename" : "Icon-40.png" + "size" : "29x29" }, { + "filename" : "Icon-Small@2x.png", "idiom" : "ipad", - "size" : "40x40", "scale" : "2x", - "filename" : "Icon-40@2x.png" + "size" : "29x29" }, { + "filename" : "Icon-40.png", "idiom" : "ipad", - "size" : "76x76", "scale" : "1x", - "filename" : "Icon-76.png" + "size" : "40x40" }, { + "filename" : "Icon-40@2x.png", "idiom" : "ipad", - "size" : "76x76", "scale" : "2x", - "filename" : "Icon-76@2x.png" + "size" : "40x40" + }, + { + "filename" : "Icon-76.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "Icon-76@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "Icon-1024.png", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "makeappicon" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Example/Assets.xcassets/AppIcon.appiconset/Icon-1024.png b/Example/Assets.xcassets/AppIcon.appiconset/Icon-1024.png new file mode 100644 index 0000000000..635f6d61b2 Binary files /dev/null and b/Example/Assets.xcassets/AppIcon.appiconset/Icon-1024.png differ diff --git a/Example/Classes/Models/Post.h b/Example/Classes/Models/Post.h index 874008cefb..2f1c381a81 100644 --- a/Example/Classes/Models/Post.h +++ b/Example/Classes/Models/Post.h @@ -1,6 +1,6 @@ // Post.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/Classes/Models/Post.m b/Example/Classes/Models/Post.m index 55dbcbba27..d922f3ff90 100644 --- a/Example/Classes/Models/Post.m +++ b/Example/Classes/Models/Post.m @@ -1,6 +1,6 @@ // Post.m // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 @@ -44,7 +44,7 @@ - (instancetype)initWithAttributes:(NSDictionary *)attributes { #pragma mark - + (NSURLSessionDataTask *)globalTimelinePostsWithBlock:(void (^)(NSArray *posts, NSError *error))block { - return [[AFAppDotNetAPIClient sharedClient] GET:@"stream/0/posts/stream/global" parameters:nil progress:nil success:^(NSURLSessionDataTask * __unused task, id JSON) { + return [[AFAppDotNetAPIClient sharedClient] GET:@"stream/0/posts/stream/global" parameters:nil headers: nil progress:nil success:^(NSURLSessionDataTask * __unused task, id JSON) { NSArray *postsFromResponse = [JSON valueForKeyPath:@"data"]; NSMutableArray *mutablePosts = [NSMutableArray arrayWithCapacity:[postsFromResponse count]]; for (NSDictionary *attributes in postsFromResponse) { diff --git a/Example/Classes/Models/User.h b/Example/Classes/Models/User.h index b28ba9c2e7..2b1e733c21 100644 --- a/Example/Classes/Models/User.h +++ b/Example/Classes/Models/User.h @@ -1,6 +1,6 @@ // User.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/Classes/Models/User.m b/Example/Classes/Models/User.m index 5c31c8069d..5565b71c0a 100644 --- a/Example/Classes/Models/User.m +++ b/Example/Classes/Models/User.m @@ -1,6 +1,6 @@ // User.m // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.h b/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.h index 95fc12a34d..7dbe92df86 100644 --- a/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.h +++ b/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.h @@ -1,6 +1,6 @@ // AFAppDotNetAPIClient.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.m b/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.m index 2908ff7870..658a1f6ccd 100644 --- a/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.m +++ b/Example/Classes/Networking Extensions/AFAppDotNetAPIClient.m @@ -1,6 +1,6 @@ // AFAppDotNetAPIClient.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/Today Extension Example/TodayViewController.h b/Example/Today Extension Example/TodayViewController.h index 862c39587e..26e472f324 100644 --- a/Example/Today Extension Example/TodayViewController.h +++ b/Example/Today Extension Example/TodayViewController.h @@ -1,5 +1,6 @@ // TodayViewController.h -// Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) +// +// Copyright (c) 2011–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 diff --git a/Example/Today Extension Example/TodayViewController.m b/Example/Today Extension Example/TodayViewController.m index 0da2d78595..0aa96f8edc 100644 --- a/Example/Today Extension Example/TodayViewController.m +++ b/Example/Today Extension Example/TodayViewController.m @@ -1,7 +1,6 @@ // TodayViewController.m // -// Copyright (c) 2015 Brian Nickel -// +// Copyright (c) 2011–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 @@ -51,7 +50,6 @@ - (void)viewWillAppear:(BOOL)animated { - (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler { [Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) { if (!error) { - self.post = posts.firstObject; [self savePost:self.post]; diff --git a/Example/iOS Example/AppDelegate.h b/Example/iOS Example/AppDelegate.h index 0dd73b758b..36bab42484 100644 --- a/Example/iOS Example/AppDelegate.h +++ b/Example/iOS Example/AppDelegate.h @@ -1,6 +1,6 @@ // AppDelegate.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/iOS Example/AppDelegate.m b/Example/iOS Example/AppDelegate.m index ab4c60e19d..8ee01ebb09 100644 --- a/Example/iOS Example/AppDelegate.m +++ b/Example/iOS Example/AppDelegate.m @@ -1,6 +1,6 @@ // AppDelegate.m // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/iOS Example/Controllers/GlobalTimelineViewController.h b/Example/iOS Example/Controllers/GlobalTimelineViewController.h index 009cb547b1..7f56649647 100644 --- a/Example/iOS Example/Controllers/GlobalTimelineViewController.h +++ b/Example/iOS Example/Controllers/GlobalTimelineViewController.h @@ -1,6 +1,6 @@ // GlobalTimelineViewController.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/iOS Example/Controllers/GlobalTimelineViewController.m b/Example/iOS Example/Controllers/GlobalTimelineViewController.m index d66daa0309..ec41e890b3 100644 --- a/Example/iOS Example/Controllers/GlobalTimelineViewController.m +++ b/Example/iOS Example/Controllers/GlobalTimelineViewController.m @@ -1,6 +1,6 @@ // GlobalTimelineViewController.m // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/iOS Example/Info.plist b/Example/iOS Example/Info.plist index 0d2fa5c44c..6343f948e2 100644 --- a/Example/iOS Example/Info.plist +++ b/Example/iOS Example/Info.plist @@ -32,7 +32,7 @@ CFBundleSignature ???? CFBundleVersion - 1.0.0 + $(CURRENT_PROJECT_VERSION) LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/Example/iOS Example/Views/PostTableViewCell.h b/Example/iOS Example/Views/PostTableViewCell.h index 8336b2431e..1b58f21468 100644 --- a/Example/iOS Example/Views/PostTableViewCell.h +++ b/Example/iOS Example/Views/PostTableViewCell.h @@ -1,6 +1,6 @@ // TweetTableViewCell.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/iOS Example/Views/PostTableViewCell.m b/Example/iOS Example/Views/PostTableViewCell.m index d992785acb..42ce04fd68 100644 --- a/Example/iOS Example/Views/PostTableViewCell.m +++ b/Example/iOS Example/Views/PostTableViewCell.m @@ -1,6 +1,6 @@ // TweetTableViewCell.m // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/OS X Example/AppDelegate.h b/Example/macOS Example/AppDelegate.h similarity index 94% rename from Example/OS X Example/AppDelegate.h rename to Example/macOS Example/AppDelegate.h index 2a5eddbcaa..01c995fd3c 100644 --- a/Example/OS X Example/AppDelegate.h +++ b/Example/macOS Example/AppDelegate.h @@ -1,6 +1,6 @@ // AppDelegate.h // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 diff --git a/Example/OS X Example/AppDelegate.m b/Example/macOS Example/AppDelegate.m similarity index 91% rename from Example/OS X Example/AppDelegate.m rename to Example/macOS Example/AppDelegate.m index 0eb1fae7aa..d4658dbf87 100644 --- a/Example/OS X Example/AppDelegate.m +++ b/Example/macOS Example/AppDelegate.m @@ -1,6 +1,6 @@ // AppDelegate.m // -// Copyright (c) 2012 Mattt Thompson (http://mattt.me/) +// Copyright (c) 2011–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 @@ -46,8 +46,10 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification { self.postsArrayController.content = posts; }]; + __weak __typeof(self)weakSelf = self; [[NSNotificationCenter defaultCenter] addObserverForName:kUserProfileImageDidLoadNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { - [self.tableView reloadData]; + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf.tableView reloadData]; }]; } diff --git a/Example/OS X Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/macOS Example/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Example/OS X Example/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Example/macOS Example/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Example/OS X Example/Info.plist b/Example/macOS Example/Info.plist similarity index 100% rename from Example/OS X Example/Info.plist rename to Example/macOS Example/Info.plist diff --git a/Example/OS X Example/MainMenu.xib b/Example/macOS Example/MainMenu.xib similarity index 86% rename from Example/OS X Example/MainMenu.xib rename to Example/macOS Example/MainMenu.xib index 9ec30caa42..407b43c0e3 100644 --- a/Example/OS X Example/MainMenu.xib +++ b/Example/macOS Example/MainMenu.xib @@ -1,7 +1,9 @@ - - + + - + + + @@ -13,10 +15,10 @@ - - + + - + @@ -31,7 +33,7 @@ - + @@ -50,7 +52,7 @@ - + @@ -148,7 +150,7 @@ - + @@ -158,33 +160,32 @@ - - + + - - + + - + - + - + - - + + - + - @@ -192,11 +193,11 @@ - + - + @@ -221,14 +222,12 @@ - + - - - + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad mi. @@ -239,15 +238,14 @@ - - + - - - + + + @@ -261,25 +259,25 @@ - -