Compare commits

..

203 Commits

Author SHA1 Message Date
WELCommand
555385d2b8 Fix associated object bug in UIKit extensions (#3872) 2020-01-04 19:34:04 -05:00
Cédric Luthi
2da270be61 Search for default pinned certificates in the main bundle (#3752)
Using `[NSBundle bundleForClass:[self class]]` is dangerous because the code will behave differently depending on how AFNetworking is integrated.

* If it is integrated as a static library (for example using CocoaPods), certificates will be searched in the main bundle.

* If it is integrated as a framework (for example using Carthage), certificates will be searched in the AFNetworking framework.

Even though this behavior is documented, this is dangerous. Using the main bundle makes the behavior deterministic.

Fixes #3575
2020-01-04 19:26:41 -05:00
svoit
0fba527112 Fix reference cycle in example, remove unnecessary weak / strong (#4196)
* Fixed memory leak issues

* Fixed memory leak issues

* Fixed crash
2020-01-04 19:19:31 -05:00
Bofei Zhu
4743faa83c Fix travis CI build (#4472)
* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* update fastlane settings

* nit

* fix tvos

* Update AFTestCase.m

* revert timeout

* Update AFUIWebViewTests.m

* Update .env.ios12_xcode10
2020-01-04 18:26:32 -05:00
Chris Streeter
eb9ce0e23d Use dispatch_barrier_sync (#4474)
This should hopefully avoid any problems where we attempt to write an
HTTP header to a deallocated header dictionary.

See https://github.com/AFNetworking/AFNetworking/pull/3891
See https://github.com/AFNetworking/AFNetworking/issues/3636
Modified from 32760e7a3a

Fixes #1391
2020-01-04 18:24:33 -05:00
Tiago Janela
5cf601ce0c Updated SSL Pinning Test Assets (#4463) 2019-10-26 18:34:47 -04:00
yehuanwen
006e896fbc Fix typeof (#3912) 2019-10-20 23:23:30 -04:00
Gavin King
9dcc6efd85 adding tvOS user agent information (#4014) 2019-10-20 23:02:35 -04:00
Jeff Kelley
2c2d2c3062 Update code coverage settings (#4201)
* Ignore coverage of test code.

* Add a second code coverage lane.

* Increase testing for code coverage.

* Fix the name of the Apple TV simulator.

* Delete .env.osx_10.10_xcode6

* Delete .env.osx_10.9_xcode6
2019-10-20 22:39:56 -04:00
Mars Lan
7383ffc61f Fix CHANGELOG Styling (#4460) 2019-10-20 22:00:32 -04:00
Elf Sundae
023cec7994 Fix NSSecureCoding (#4409)
* Fix type for decoding object

* Fix encoding numeric
2019-10-20 21:53:18 -04:00
Jeff Kelley
685e31a31b
Merge pull request #4365 from classdojo/cd-master
Fix podspec #trivial #important
2019-03-01 14:00:35 -05:00
Jakub Kaspar
b3c4a78aca Fix podspec as pod version supports iOS 8+ but podspec says iOS 7+ 2019-03-01 16:23:33 +01:00
Jeff Kelley
ee950948f2
Merge pull request #4200 from svoit/code_cleaning
Code cleaning
2019-02-09 13:18:38 -05:00
Jeff Kelley
9cc782931a
Merge pull request #4357 from AFNetworking/update-httpbin-certificates-april-2019
Update HTTPBin certificates in tests
2019-02-09 13:11:50 -05:00
Jeff Kelley
3517a1d23c Update HTTPBin certificates 2019-02-09 11:38:10 -05:00
Jeff Kelley
5890adc404
Merge pull request #4298 from AFNetworking/update-httpbin-certificates-december-2018
Update HTTPBin certificates, good through December 2018.
2018-10-14 10:20:46 -04:00
Jeff Kelley
ba4238910e Update HTTPBin certificates, good through December 2018. 2018-10-10 23:02:34 -04:00
svoit
d6db8307d9 Merge branch 'master' into code_cleaning
* master: (61 commits)
  Update Travis config for Xcode 10.
  Add test for object posting notification
  update README.md, the old "Foundation URL Loading System" link is 404
  Change test name to correct one
  Change default teardown methods to tests
  Update tests to use new API
  Update PR feedback, add more tests
  Add test
  remove temporary method that could be doing nothing
  Update HTTPBin certificates.
  Chinese CONTRIBUTING.md translate
  Delete CONTRIBUTING_CH.md
  Chinese Contributing.md translate
  rollback method 'AFPostReachabilityStatusChange'
  Use AFNetworkReachabilityManager to compare  consistency of notification posts and gets, instead of SCNetworkReachabilityRef. And test case reference.
  Remove test that is nilling session manually as it's not possible anymore to not have valid session (correctly)
  Add tests for  verifing reachability manager consistence  for notification posting and getting
  Specify Xcode 9.4 in Travis file.
  Update AFImageDownloader.m
  Add an ability that notification-observer know which reachability its belong
  ...
2018-10-08 23:28:53 +02:00
Jeff Kelley
27608c91d0
Merge pull request #4081 from MapaX/master
Fixed CLANG_ENABLE_CODE_COVERAGE flag so release can be made
2018-10-02 12:10:55 -04:00
Jeff Kelley
1bd73c7fca
Merge pull request #4256 from classdojo/cd-master
Fix crashes and memory leaks
2018-09-24 14:00:21 -04:00
Jeff Kelley
59e92b18c6
Merge pull request #4293 from AFNetworking/xcode-10
Update Travis config for Xcode 10.
2018-09-24 13:24:04 -04:00
Jeff Kelley
fdbec013c4 Update Travis config for Xcode 10. 2018-09-24 12:35:04 -04:00
Jeff Kelley
99cda82d33
Merge pull request #4286 from rob2468/master
update README.md, the old "Foundation URL Loading System" link is 404
2018-09-24 12:27:48 -04:00
Jeff Kelley
e46e64c274
Merge pull request #4248 from LMsgSendNilSelf/#4247
Add an ability that notification-observer know which reachability it belongs
2018-09-21 16:16:33 -04:00
Jeff Kelley
390e8fa6d4
Merge pull request #4262 from jin940/master
Chinese version for CONTRIBUTING.md
2018-09-21 15:41:04 -04:00
wangpeng
dea4316db0 Add test for object posting notification 2018-09-20 16:15:30 +08:00
jam.chenjun
23a6f442c8 update README.md, the old "Foundation URL Loading System" link is 404 2018-09-18 15:01:40 +08:00
Jakub Kaspar
9bb8ea7452 Change test name to correct one 2018-09-13 10:56:00 -07:00
Jakub Kaspar
af23240a4b Change default teardown methods to tests 2018-09-11 12:58:25 -07:00
Jakub Kaspar
0579f71d5a Update tests to use new API 2018-09-11 12:20:21 -07:00
Jakub Kaspar
864c8d6aed Update PR feedback, add more tests 2018-09-11 12:15:01 -07:00
Jeff Kelley
7b48feb383
Merge branch 'master' into master 2018-09-08 11:54:27 -04:00
Jakub Kaspar
3c54e1f8a5 Add test 2018-08-14 08:52:28 +02:00
Jakub Kaspar
a8758d26d5 Merge branch 'master' into cd-master
# Conflicts:
#	Tests/Tests/AFURLSessionManagerTests.m
2018-08-13 22:44:03 +02:00
Jakub Kaspar
64795368ae Merge remote-tracking branch 'as_origin/master'
# Conflicts:
#	AFNetworking/AFNetworkReachabilityManager.h
#	AFNetworking/AFURLSessionManager.m
2018-08-13 22:42:56 +02:00
Jakub Kaspar
86c8cc2263 remove temporary method that could be doing nothing 2018-08-13 22:34:41 +02:00
Jeff Kelley
b892e566f9
Merge pull request #4269 from AFNetworking/update-httpbin-certificates-october-2018
Update HTTPBin certificates, valid through October 2018.
2018-08-08 16:46:47 -04:00
Jeff Kelley
12088d6d37 Update HTTPBin certificates. 2018-08-08 14:23:40 -04:00
Jeff Kelley
a24b4896bb
Merge pull request #4113 from stnslw/headers-per-request
Support for setting headers per request when using AFHTTPSessionManager.
2018-07-31 00:05:58 -04:00
Jeff Kelley
a101152743
Merge pull request #4237 from Caelink/master
Implement two ways to collect NSURLSessionTaskMetrics
2018-07-30 23:47:01 -04:00
jin940
5b92ed3368
Chinese CONTRIBUTING.md translate
Chinese CONTRIBUTING.md translate
2018-07-29 01:07:45 +08:00
jin940
17edb8138a
Delete CONTRIBUTING_CH.md 2018-07-29 01:06:01 +08:00
jin940
7ff008b872
Chinese Contributing.md translate
Chinese Contributing.md translate
2018-07-29 01:00:38 +08:00
wangpeng
619a65b57e rollback method 'AFPostReachabilityStatusChange' 2018-07-25 22:00:31 +08:00
wangpeng
91cc666887 Use AFNetworkReachabilityManager to compare consistency of notification posts and gets, instead of SCNetworkReachabilityRef.
And test case reference.
2018-07-25 21:48:31 +08:00
Jakub Kaspar
926d4dbb8b Remove test that is nilling session manually as it's not possible anymore to not have valid session (correctly) 2018-07-23 12:20:10 +02:00
Jakub Kaspar
5544ef03f4 Merge branch 'master' into cd-master
* master: (71 commits)
  Specify Xcode 9.4 in Travis file.
  Update AFImageDownloader.m
  Safely get mergedTasks On responseQueue
  Update HTTPBin certificates.
  Update block usage requirements.
  Fixed tests.
  Update AFAutoPurgingImageCache.m
  Preparing for the 3.2.1 release
  Fix issues with AFCompatibilityMacros.h
  Add AFCompatibilityMacros.h to podspec.
  Add new .env files for iOS 11.x
  Update SDK settings in Travis config.
  Use old SDKs to test earlier versions of iOS 11.
  Update default SDK for iOS and tvOS
  Update umbrella header.
  Update HTTPBin certificates for April 2018.
  Remove beta from 9.3 image
  Update asset catalog JSON.
  Tweak tests to send expressions directly.
  Add tests and also prohibit +new from working.
  ...

# Conflicts:
#	AFNetworking/AFNetworkReachabilityManager.h
#	AFNetworking/AFURLSessionManager.m
2018-07-23 11:15:48 +02:00
wangpeng
ffbcabeb58 Add tests for verifing reachability manager consistence for notification posting and getting 2018-07-15 15:51:03 +08:00
Jeff Kelley
7642bcf659
Merge pull request #4249 from AFNetworking/xcode-9.4
Update Travis settings for Xcode 9.4
2018-07-13 18:04:45 -04:00
Jeff Kelley
9c2742c868 Specify Xcode 9.4 in Travis file. 2018-07-13 17:19:50 -04:00
Jeff Kelley
5fe5ea3355 Merge branch 'master' into pr/4051 2018-07-13 17:09:18 -04:00
Jeff Kelley
d135b740da
Merge pull request #4246 from bbeversdorf/master
Safely get mergedTasks On responseQueue
2018-07-13 15:16:47 -04:00
bbeversdorf
342653f27e
Update AFImageDownloader.m 2018-07-13 10:15:08 -05:00
wangpeng
06079adbe4 Add an ability that notification-observer know which reachability its belong 2018-07-13 18:33:01 +08:00
Brian Beversdorf
1c52c76537 Safely get mergedTasks On responseQueue
There is a race condition in -[AFImageDownloader downloadImageForURLRequest:withReceiptID:success:failure:] that can cause a crash.

#3876
#3984
2018-07-12 16:09:29 -05:00
Caelin Jackson-King
1d1c0241a9 Replace the version numbers with raw values 2018-07-02 17:00:18 -07:00
Caelin Jackson-King
ca380fdcfc Inverted preprocessor logic to check iff version exists in target 2018-06-29 16:50:35 -07:00
Caelin Jackson-King
54f11357d7 Replaced preprocessor variable to make sure all valid targets allow NSURLSessionTaskMetrics 2018-06-29 15:25:26 -07:00
Caelin Jackson-King
6622b05771 Missed one use of related type 2018-06-29 14:40:17 -07:00
Caelin Jackson-King
63410f3567 Xcode 7.x compatibility 2018-06-29 11:49:55 -07:00
Caelin
d0448a80f4
Merge pull request #1 from Caelink/didFinishCollectingMetrics
Implemented methods for collecting NSURLSessionTaskMetrics
2018-06-29 10:56:08 -07:00
Caelin Jackson-King
c4caddc5e9 Tests for notification and block use 2018-06-29 10:50:58 -07:00
Caelin Jackson-King
aed00d3099 Test for notification publishing the metrics 2018-06-28 16:38:16 -07:00
Caelin Jackson-King
fba4f366d2 Added kvo use of sessionTaskMetrics 2018-06-28 16:15:18 -07:00
Caelin Jackson-King
ad7b31f4f9 First stab at adding a block to be called and implementing didFinishCollectingMetrics on the SessionManager 2018-06-28 15:03:26 -07:00
Jeff Kelley
009e3bb667
Merge pull request #4225 from AFNetworking/update-httpbin-certificates-august-2018
Update HTTPBin certificates, valid through August 2018.
2018-06-09 13:44:52 -07:00
Jeff Kelley
d768f1c7c5 Update HTTPBin certificates. 2018-06-08 10:02:15 -07:00
Jeff Kelley
684dfe05d8 Update block usage requirements. 2018-06-07 23:09:14 -07:00
Jeff Kelley
41782ab4d6 Merge branch 'pr/3962' 2018-06-07 23:06:00 -07:00
Jeff Kelley
850974c941 Merge remote-tracking branch 'origin/master' 2018-06-07 23:03:26 -07:00
Jeff Kelley
61e15f412b Merge branch 'pr/4052' 2018-06-07 22:59:25 -07:00
Jeff Kelley
b15888735a
Merge pull request #4002 from LeeHongHwa/fix_coding_convention
fix space used in Objective-C method (coding style)
2018-06-07 22:56:28 -07:00
Jeff Kelley
48b63fa252 Fixed tests. 2018-06-07 22:50:31 -07:00
Jeff Kelley
447d7f3c58 Merge branch 'pr/4088' 2018-06-07 22:45:04 -07:00
Jeff Kelley
207a707fa3
Merge pull request #4206 from Huang-Libo/patch-1
Update AFAutoPurgingImageCache.m
2018-06-07 22:33:40 -07:00
Huang-Libo
357466d102
Update AFAutoPurgingImageCache.m
NSString property should use `copy`.
2018-05-07 00:51:45 +08:00
Jeff Kelley
746f6c3a1e Preparing for the 3.2.1 release 2018-05-04 12:59:26 -04:00
Jeff Kelley
6897b06049 Fix issues with AFCompatibilityMacros.h 2018-05-04 11:38:18 -04:00
Jeff Kelley
29021d2eeb
Merge pull request #4203 from AFNetworking/add-compatibility-macros-to-podspec
Add AFCompatibilityMacros.h to podspec.
2018-04-25 02:18:10 -04:00
Jeff Kelley
eb0635cb1b Add AFCompatibilityMacros.h to podspec. 2018-04-25 00:14:44 -04:00
Jeff Kelley
e08306e789
Merge pull request #4199 from AFNetworking/xcode-9.3
Xcode 9.3 Support
2018-04-13 14:10:03 -04:00
Jeff Kelley
899109bec8 Add new .env files for iOS 11.x 2018-04-11 20:13:04 -04:00
svoit
e6c674ed84 Removed redundant switch case 2018-04-11 23:22:18 +02:00
Jeff Kelley
fd98ef0d65 Update SDK settings in Travis config. 2018-04-11 16:53:03 -04:00
Jeff Kelley
f0fe188b7e Use old SDKs to test earlier versions of iOS 11. 2018-04-11 10:23:11 -04:00
Jeff Kelley
2927f79908 Merge remote-tracking branch 'origin/master' into xcode-9.3 2018-04-11 10:19:45 -04:00
Jeff Kelley
accf62f65a
Update default SDK for iOS and tvOS 2018-04-10 22:38:01 -04:00
Jeff Kelley
20bc43628e
Merge pull request #4198 from AFNetworking/april-2018-certificate-updates
Update HTTPBin certificates for April 2018.
2018-04-10 19:17:29 -04:00
svoit
1f70ba85bb Code cleaning 2018-04-10 23:23:46 +02:00
Jeff Kelley
a2401da932 Update umbrella header. 2018-04-10 17:14:22 -04:00
Jeff Kelley
09f49eb90a Update HTTPBin certificates for April 2018. 2018-04-10 17:13:58 -04:00
Jeff Kelley
4f4e4a96a9 Merge branch 'xcode-9.3' of github.com:AFNetworking/AFNetworking into xcode-9.3 2018-04-02 16:17:13 -04:00
Jeff Kelley
33f69a6f23 Merge branch 'master' into xcode-9.3 2018-04-02 16:17:10 -04:00
Jeff Kelley
49d3fe112e Remove beta from 9.3 image 2018-03-29 16:48:08 -04:00
Jeff Kelley
bc323baaa5 Update asset catalog JSON. 2018-03-29 16:47:11 -04:00
Jeff Kelley
9e005d9714
Merge pull request #4182 from AFNetworking/init-nullable-specifier-fix
Remove conflicting nullable specifier on init
2018-03-23 15:26:15 -04:00
Jeff Kelley
68214ee292 Tweak tests to send expressions directly. 2018-03-23 14:38:00 -04:00
Jeff Kelley
abd34500ab Add tests and also prohibit +new from working. 2018-03-23 14:35:39 -04:00
Jeff Kelley
b3f5f644a4
Merge pull request #4179 from AFNetworking/fix-xcode-brace-parsing
Move a brace to make Xcode happy.
2018-03-16 11:42:56 -04:00
Jeff Kelley
10afc7c4ac Merge branch 'xcode-9.3' of github.com:AFNetworking/AFNetworking into xcode-9.3 2018-03-16 11:40:42 -04:00
Jeff Kelley
adc8004b2b Update Travis config for Xcode 9.3 beta. 2018-03-16 11:40:37 -04:00
Nick Brook
2315d76280 Remove conflicting nullable specifier on init
The nullable specifier on init conflicts with the nonnull specifier on NSObject which generates a warning. This change removes it and throws an exception if init is used.
2018-03-16 09:29:29 -04:00
Jeff Kelley
03423c877f Merge remote-tracking branch 'origin/master' into xcode-9.3 2018-03-16 09:27:59 -04:00
Jeff Kelley
5d4b628906 Merge remote-tracking branch 'origin/master' into fix-xcode-brace-parsing 2018-03-16 09:27:38 -04:00
Jeff Kelley
7bc866d47a
Merge pull request #4180 from AFNetworking/update-fastlane-configuration
Update Fastlane Configuration
2018-03-16 09:26:41 -04:00
Jeff Kelley
09394030e1 Update Fastfile import branch. 2018-03-15 17:05:38 -04:00
Jeff Kelley
15f09aeb65 Merge branch 'master' into xcode-9.3 2018-03-15 15:17:11 -04:00
Jeff Kelley
b013b458c5 Move a brace to make Xcode happy.
The trailing brace within the #ifdef was confusig Xcode parsing the structure of the file.
2018-03-15 15:12:07 -04:00
Jeff Kelley
1a5b4814ea
Merge pull request #4131 from aduflo/patch-1
UIImageView+AFNetworking: Prevent stuck state for malformed urlRequest
2018-02-26 10:26:20 -05:00
aduflo
6184295398 Merge branch 'master' of https://github.com/AFNetworking/AFNetworking into patch-1 2018-02-25 10:54:55 -05:00
Jeff Kelley
29e0573128
Merge pull request #4155 from AFNetworking/february-2018-certificate-updates
Update HTTPBin.org certificates.
2018-02-24 22:18:33 -05:00
Jeff Kelley
1dc9e87729 Define compatibility macros. 2018-02-15 18:14:09 -05:00
Jeff Kelley
871dcf0da4 Finish marking macOS bits as unavailable. 2018-02-15 17:48:47 -05:00
Jeff Kelley
3a344e3d6f Comment out unavailable macOS API.
There’s a new warning for this in Xcode 9.3’s recommended settings.
2018-02-15 17:12:25 -05:00
Jeff Kelley
0de996f84b Apply recommended changes for Xcode 9.3 beta 1. 2018-02-15 17:11:57 -05:00
Jeff Kelley
7ea8c74739 Update HTTPBin.org certificates.
These will expire on 4/11/2018.
2018-02-15 16:47:18 -05:00
aduflo
8232b54262 Merge branch 'master' of https://github.com/aduflo/AFNetworking into patch-1 2018-02-15 10:10:20 -05:00
Jeff Kelley
e976d63ed2
Merge pull request #4138 from AFNetworking/unguarded-availability
Use @available if available to silence a warning.
2018-01-27 00:55:59 -05:00
Jeff Kelley
b32766772d Fix for Xcode 8. 2018-01-26 14:21:47 -05:00
Jeff Kelley
00ae01d063 Remove tvOS and watchOS availability checks.
tvOS 9 and watchOS 2 are the minimum version supported by AFNetworking,
so there’s no reason to do an additional check for them (they will be
included by the `*`).
2018-01-26 13:08:09 -05:00
Jeff Kelley
5521f5e0c5 Use @available if available to silence a warning. 2018-01-26 13:03:51 -05:00
Jeff Kelley
78ce859962
Merge pull request #4122 from AFNetworking/merge-fix
Fix analyzer warning for upload task creation
2018-01-26 11:36:34 -05:00
Dan Loewenherz
2d19dc8540 use Objective-C 2.0 subscripting 2018-01-14 09:10:04 -06:00
aduflo
f0b1149731 added test to cover image download with malformed url 2018-01-12 09:42:34 -05:00
Adam Duflo
0b35a643c6
Prevent stuck state for bad urlRequest 2018-01-10 16:17:52 -05:00
Jeff Kelley
bcede21e8a
Merge pull request #4125 from liaodalin19903/master
add the link for LICENSE
2018-01-09 21:25:33 -05:00
Liao Malin
944c3768a5
add the link for LICENSE
User can find the LICENSE address conveniently
2018-01-09 13:29:21 +08:00
Jeff Kelley
67dd69e632 Simpler version that avoid assertions. 2018-01-08 23:23:51 -05:00
Jeff Kelley
5aaaa501fc Add a test method for the bad case. 2018-01-08 23:12:56 -05:00
Jeff Kelley
bf9b920187 Move task creation inside block. 2018-01-07 23:23:29 -05:00
Jeff Kelley
f07fe50814
Merge pull request #4123 from AFNetworking/update-travis
Update Travis configuration for Xcode 9.2.
2018-01-07 23:22:42 -05:00
Jeff Kelley
3972e95c80 Uninstall executables when uninstalling Bundler. 2018-01-07 22:30:00 -05:00
Jeff Kelley
eae14bd8ce Consistent naming. 2018-01-06 23:35:08 -05:00
Jeff Kelley
a5933f3f83 Update Travis configuration for Xcode 9.2. 2018-01-06 23:33:13 -05:00
Jeff Kelley
15116f93b1 Preparing for the 3.2.0 release 2017-12-15 11:30:24 -05:00
Jeff Kelley
b0d24a08db
Merge pull request #4010 from WJE/config_afimagedownloader_nsurlcache
Config AFImageDownloader NSURLCache and ask AFImageRequestCache implementer if an image should be cached
2017-12-15 10:39:03 -05:00
Jeff Kelley
f7ecca5420
Merge pull request #4104 from SlaunchaMan/2017-updates
2017 Updates
2017-12-15 10:38:42 -05:00
Stanisław Brzeski
5e19a4df0b Minor codestyle fix 2017-12-15 16:31:03 +01:00
Stanisław Brzeski
ded6a76946 Added support for setting headers per HTTP request 2017-12-15 15:54:23 +01:00
Jeff Kelley
4de115625a
Merge pull request #3750 from skyline75489/master
Clarify documentation for supported encodings in AFJSONResponseSerializer
2017-11-23 20:51:56 -05:00
skyline75489
8ad70504fb Fix typo 2017-11-24 06:53:25 +08:00
Chester Liu
9fbf003dd6 Update content to reflect the newer RFC 2017-11-24 06:53:25 +08:00
skyline75489
84e409d6ae Clarify documentation for supported encodings in AFJSONResponseSerializer 2017-11-24 06:53:25 +08:00
Jeff Kelley
fc941b3336 Rename Fastlane env scheme. 2017-11-23 01:04:04 -05:00
Jeff Kelley
f6439cfa09 Remove redundant iOS deployment target setting. 2017-11-23 01:00:31 -05:00
Jeff Kelley
0c193a2c37 Set Xcode compatibility to Xcode 6.3 and up. 2017-11-23 01:00:19 -05:00
Jeff Kelley
4b64a60d4b Change “OS X” to “macOS” across the board.
Also change the “Today Extension Example” to specify iOS now that macOS
has those too.
2017-11-23 00:19:44 -05:00
Jeff Kelley
f45a3abf08 Fix analyzer warning about memory leak. 2017-11-23 00:05:51 -05:00
Jeff Kelley
20ff51cb8e Fix analyzer warning about NULL dereference. 2017-11-23 00:05:43 -05:00
Jeff Kelley
00addee8a1 Fix analyzer warning about mutable copies. 2017-11-23 00:05:25 -05:00
Jeff Kelley
1f2ffbb41b Update project settings to Xcode 9.1 defaults. 2017-11-23 00:05:16 -05:00
Jeff Kelley
9d5a894cb0
Merge pull request #3753 from skyline75489/xml-tests
Add XMLParser/XMLDocument serializer tests
2017-11-22 23:59:53 -05:00
Jeff Kelley
3297dfe5f0
Update security policy test certificates (#4103) 2017-11-22 23:47:31 -05:00
Jakub Kaspar
c976cf3db8 fix crashes 2017-11-12 12:20:24 -08:00
Matti Mustonen
d8f45e79e5 Fixed init method nullability to default value 2017-10-13 10:28:52 +03:00
Matti Mustonen
1e03fb1a72 Fixed CLANG_ENABLE_CODE_COVERAGE flag so release can be made 2017-10-12 13:49:40 +03:00
Ash Furrow
75763005cb
Modifies AFJSONObjectByRemovingKeysWithNullValues to remove NSArray null objects. 2017-09-18 11:11:02 -04:00
Ash Furrow
849dff7dee
Exposes C function prototype. 2017-09-18 10:47:07 -04:00
Henddher Pedroza
9b33c1699f self in block 2017-07-28 17:11:47 -05:00
Henddher Pedroza
6554afe3c9 Merge branch 'config_afimagedownloader_nsurlcache' of https://github.com/WJE/AFNetworking into config_afimagedownloader_nsurlcache 2017-07-28 16:22:05 -05:00
Henddher Pedroza
c69c109da8 Remove usage of XCTestExpectation.inverted (not supported) 2017-07-28 16:19:34 -05:00
Henddher Pedroza
a241b4fcdd Remove usage of XCTestExpectation.inverted (not supported) 2017-07-28 15:46:45 -05:00
Henddher Pedroza
6babb5f039 Test-cases. 2017-07-28 15:29:53 -05:00
Henddher Pedroza
51a80847ed Ask <AFImageRequestCache> implementor if an image should be cached. Implementors may prevent caching. 2017-07-28 11:15:44 -05:00
Henddher Pedroza
f6f64c83b3 Remove setter for defaultURLCache 2017-07-28 08:48:58 -05:00
Henddher Pedroza
8db67cdfa9 Allow initialization of AFImageDownloader using custom NSURLSessionConfiguration. 2017-07-28 08:45:02 -05:00
Henddher Pedroza
41897b19c6 Ability to set the defaultURLCache 2017-07-26 18:10:07 -05:00
Dominik Gruber
dd59ffa188 Allow return value of HTTP redirection block to be NULL (#3975)
* Allow return value of HTTP redirection block to be NULL

* Make tests pass again (#3993)

* Make tests pass again

* Fix macOS builds in Fastlane.
2017-07-22 19:01:50 -04:00
leehonghwa
27c819537a Fix asterisk location in method declaration 2017-07-19 15:08:26 +09:00
leehonghwa
c18c09a75c fix space used in Objective-C method (coding style) 2017-07-19 14:29:27 +09:00
Josh Friend
e6d975619e Fix CHANGELOG formatting (#3915) 2017-07-13 15:06:12 -04:00
skyline75489
158dc56d30 Fix a failure description 2017-07-13 20:00:46 +08:00
skyline75489
0840d05555 Fix some typo 2017-07-13 20:00:45 +08:00
skyline75489
0ffb17d619 Add XMLParser/XMLDocument serializer tests 2017-07-13 20:00:45 +08:00
Jeff Kelley
ec5c955059 Make tests pass again (#3993)
* Make tests pass again

* Fix macOS builds in Fastlane.
2017-07-12 22:24:56 -04:00
BKKim
f8159fee72 Fix AFURLSessionManager security weakness
crashes when calling to a released block pointer
2017-05-30 21:35:54 +09:00
Cédric Luthi
4f3c694920 Merge pull request #3751 from 0xced/deprecate-stringEncoding
Deprecate the unused stringEncoding property of AFHTTPResponseSerializer
2016-10-14 14:26:23 +02:00
Cédric Luthi
33a403cb9c Deprecate AFHTTPResponseSerializer.stringEncoding
The `stringEncoding` property is never used. It was probably inroduced by error in 9a40c0dc0f. It was probably a copy/paste error as the same property also exists on `AFHTTPRequestSerializer` where it’s actually used.
2016-10-14 01:23:00 +02:00
Kevin Harwood
5b6def1f4e Merge pull request #3694 from 0xced/fix-reachability-tests
Fix reachability tests
2016-10-12 07:17:00 -05:00
Cédric Luthi
fb5022c073 Remove assertion that status in callback == reachabilityManager status
The status passed in callbacks (both block and notification) is captured before the callbacks are dispatched on the main thread. It is thus possible that the reachabilityManager status change in the meantime.

Users MUST use the status parameter for the block callback or the `AFNetworkingReachabilityNotificationStatusItem` user info key for the notification.
2016-10-12 07:54:10 +02:00
Cédric Luthi
025c82fa7b Explicitly set the expectation to nil to avoid calling fulfill twice 2016-10-12 07:41:51 +02:00
Cédric Luthi
83c33fb9a7 Enable domain reachability tests 2016-10-12 07:39:43 +02:00
Cédric Luthi
111931b32c Fulfill the expectation once the network status becomes reachable
Do not use XCTAssertEqual(reachable, ...) because it might transition to AFNetworkReachabilityStatusNotReachable before becoming reachable.
2016-10-12 07:39:43 +02:00
Cédric Luthi
550d8c3dd2 Remove unnecessary assert
This pattern does not make sense at all because the assert can never fail.

if (condition) {
    XCTAssert(condition, @"comment");
}
2016-10-12 07:39:43 +02:00
Cédric Luthi
9627d0fc20 Merge pull request #3748 from AFNetworking/httpbin-base-url
Enable custom httpbin URL with HTTPBIN_BASE_URL environment variable
2016-10-12 06:48:44 +02:00
Cédric Luthi
5d6867c3b6 Enable custom httpbin URL with HTTPBIN_BASE_URL environment variable
Editing the scheme and checking the `HTTPBIN_BASE_URL` box enables running the test suites on a default local installation of httpbin.
2016-10-11 21:34:04 +02:00
skyline75489
0e947a7ae6 Add test method to wait for common timeout without handler 2016-10-11 08:56:39 -05:00
Maksym Shcheglov
9fea2240a8 Removed ambiguous array creation. According to documentation SecTrustCreateWithCertificates takes SecCertificateRef object or an array of certificates. 2016-10-11 08:38:21 -05:00
Cédric Luthi
719a3bf60b Do not crash when passing invalid JSON for serialization
Fixes #3711

The `NSURLErrorCannotDecodeContentData` code is not ideal, but `AFURLRequestSerializationErrorDomain` should define its own error codes anyway.
2016-10-10 12:11:22 -05:00
Kevin Harwood
4429921ac1 Merge pull request #3735 from AFNetworking/3594
Fixed crash around customizing NSURLCache size for < iOS 8.2
2016-10-10 10:00:34 -05:00
Kevin Harwood
b36f0ed444 Added a comment 2016-10-10 09:21:17 -05:00
flutechang
84d18cac75 Fix crash around customizing NSURLCache size. 2016-10-10 09:21:17 -05:00
Kevin Harwood
7118eb6bbf Removed explicit xcpretty install 2016-10-10 09:04:28 -05:00
Kevin Harwood
f39ec68b44 Merge pull request #3733 from skyline75489/master
Fixed issue where UIWebView extension did not preserve all of the request information
2016-10-10 07:59:02 -05:00
Kevin Harwood
e8fde524d7 Merge pull request #3653 from tclementdev/master
Handle Error Pointers according to Cocoa Convention
2016-10-10 07:44:16 -05:00
skyline75489
0fc675e960 Use NSURLRequest to construct dataTask. Fix #3724 2016-10-09 22:00:24 +08:00
Thomas Clement
f28654cb5c Add test asserts for non-nil errors. 2016-10-06 18:28:14 +02:00
Thomas Clement
95fa90666d Fix class name comment. 2016-10-06 18:26:20 +02:00
Thomas Clement
290ec35a4a Add json/plist serializer tests for better code coverage. 2016-10-06 17:51:09 +02:00
Thomas Clement
2201d2cd55 Rewrite code flow to clarify error handling. 2016-10-06 13:07:13 +02:00
Thomas Clement
df5b5121a4 Make sure we check the return values before handling the error objects (this is the correct way to handle errors as described in Apple's documentation). 2016-10-06 12:51:02 +02:00
Thomas Clement
0be9763246 Check return value before doing anything with error. This is a Cocoa convention. 2016-10-06 12:51:02 +02:00
108 changed files with 2343 additions and 726 deletions

2
.codecov.yml Normal file
View File

@ -0,0 +1,2 @@
ignore:
- "Tests"

View File

@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7.1
osx_image: xcode11
sudo: false
env:
global:
@ -9,25 +9,29 @@ env:
- FASTLANE_LANE=ci_commit
matrix:
include:
- osx_image: xcode8
- osx_image: xcode11
env: FASTLANE_LANE=code_coverage FASTLANE_ENV=default
- osx_image: xcode8
env: FASTLANE_ENV=ios10_xcode8
- osx_image: xcode8
env: FASTLANE_ENV=tvos10_xcode8
- osx_image: xcode8
- osx_image: xcode11
env: FASTLANE_ENV=ios13_xcode11
- osx_image: xcode11
env: FASTLANE_ENV=tvos13_xcode11
- osx_image: xcode11
env: FASTLANE_ENV=osx
- osx_image: xcode7.3
env: FASTLANE_ENV=ios93_xcode73
- osx_image: xcode7.3
env: FASTLANE_ENV=ios81_xcode73
- osx_image: xcode10
env: FASTLANE_ENV=ios12_xcode10
- osx_image: xcode9.4
env: FASTLANE_ENV=ios11_xcode94
- osx_image: xcode9.3
env: FASTLANE_ENV=ios11_xcode93
- osx_image: xcode9.2
env: FASTLANE_ENV=ios11_xcode92
- osx_image: xcode9.1
env: FASTLANE_ENV=ios11_xcode91
- osx_image: xcode9
env: FASTLANE_ENV=ios11_xcode9
before_install:
# Force bundler 1.12.5 because version 1.13 has issues, see https://github.com/fastlane/fastlane/issues/6065#issuecomment-246044617
- gem uninstall bundler -v '>1.12.5' --force || echo "bundler >1.12.5 is not installed"
- gem install bundler -v 1.12.5 --no-rdoc --no-ri --no-document --quiet
- 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
- gem install fastlane --no-document --quiet
- gem install cocoapods --no-document --quiet
script:
- set -o pipefail
- fastlane $FASTLANE_LANE configuration:Debug --env $FASTLANE_ENV

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AFNetworking'
s.version = '3.1.0'
s.version = '3.2.1'
s.license = 'MIT'
s.summary = 'A delightful iOS and OS X networking framework.'
s.homepage = 'https://github.com/AFNetworking/AFNetworking'
@ -27,7 +27,7 @@ Pod::Spec.new do |s|
EOS
s.prefix_header_contents = pch_AF
s.ios.deployment_target = '7.0'
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '9.0'
@ -47,7 +47,7 @@ EOS
end
s.subspec 'Reachability' do |ss|
ss.ios.deployment_target = '7.0'
ss.ios.deployment_target = '8.0'
ss.osx.deployment_target = '10.9'
ss.tvos.deployment_target = '9.0'
@ -64,12 +64,12 @@ 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'
ss.public_header_files = 'AFNetworking/AF{URL,HTTP}SessionManager.h', 'AFNetworking/AFCompatibilityMacros.h'
end
s.subspec 'UIKit' do |ss|
ss.ios.deployment_target = '7.0'
ss.ios.deployment_target = '8.0'
ss.tvos.deployment_target = '9.0'
ss.dependency 'AFNetworking/NSURLSession'

View File

@ -3,16 +3,20 @@
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 */; };
1FE783011C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */; };
1FE783021C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */; };
1FE783031C5857A200A73B7C /* httpbinorg_01192017.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */; };
1F8482C0220F386200718111 /* httpbinorg_03172020.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F8482BF220F386200718111 /* httpbinorg_03172020.cer */; };
1F8482C1220F386200718111 /* httpbinorg_03172020.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F8482BF220F386200718111 /* httpbinorg_03172020.cer */; };
1F8482C2220F386200718111 /* httpbinorg_03172020.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F8482BF220F386200718111 /* httpbinorg_03172020.cer */; };
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 */; };
@ -54,9 +58,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 */; };
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 */; };
@ -80,12 +81,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 */; };
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 */; };
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 */; };
@ -176,6 +171,10 @@
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, ); }; };
29F5EF031C47E64F008B976A /* AFUIWebViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F5EF021C47E64F008B976A /* AFUIWebViewTests.m */; };
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 */; };
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 */; };
@ -197,6 +196,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 */
@ -225,7 +236,8 @@
/* Begin PBXFileReference section */
1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFImageResponseSerializerTests.m; sourceTree = "<group>"; };
1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = httpbinorg_01192017.cer; sourceTree = "<group>"; };
1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AFCompatibilityMacros.h; sourceTree = "<group>"; };
1F8482BF220F386200718111 /* httpbinorg_03172020.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = httpbinorg_03172020.cer; sourceTree = "<group>"; };
2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFUIButtonTests.m; sourceTree = "<group>"; };
297824A01BC2D69A0041C395 /* adn_0.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_0.cer; path = ADNNetServerTrustChain/adn_0.cer; sourceTree = "<group>"; };
297824A11BC2D69A0041C395 /* adn_1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_1.cer; path = ADNNetServerTrustChain/adn_1.cer; sourceTree = "<group>"; };
@ -233,10 +245,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 = "<group>"; };
298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Certification_Authority.cer; sourceTree = "<group>"; };
298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Domain_Validation_Secure_Server_CA.cer; sourceTree = "<group>"; };
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 = "<group>"; };
298D7C791BC2C88F00FD3B3E /* AltName.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AltName.cer; sourceTree = "<group>"; };
298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = foobar.com.cer; sourceTree = "<group>"; };
@ -298,6 +307,8 @@
2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWebView+AFNetworking.m"; sourceTree = "<group>"; };
29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFCompoundResponseSerializerTests.m; sourceTree = "<group>"; };
29F5EF021C47E64F008B976A /* AFUIWebViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFUIWebViewTests.m; sourceTree = "<group>"; };
2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFXMLParserResponseSerializerTests.m; sourceTree = "<group>"; };
2D4563931DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFXMLDocumentResponseSerializerTests.m; sourceTree = "<group>"; };
5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Equifax_Secure_Certificate_Authority_Root.cer; sourceTree = "<group>"; };
5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "GeoTrust_Global_CA-cross.cer"; sourceTree = "<group>"; };
5F4323B51BF63741003B8749 /* google.com.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = google.com.cer; sourceTree = "<group>"; };
@ -305,6 +316,10 @@
5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = GoogleComServerTrustChainPath1; sourceTree = "<group>"; };
5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = GoogleComServerTrustChainPath2; sourceTree = "<group>"; };
5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GeoTrust_Global_CA_Root.cer; sourceTree = "<group>"; };
E2B10D8B233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Starfield Services Root Certificate Authority - G2.cer"; sourceTree = "<group>"; };
E2B10D8C233035100004E005 /* Amazon Root CA 1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Amazon Root CA 1.cer"; sourceTree = "<group>"; };
E2B10D8D233035100004E005 /* Amazon.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Amazon.cer; sourceTree = "<group>"; };
E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFPropertyListRequestSerializerTests.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -398,11 +413,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 */,
1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */,
1F8482BF220F386200718111 /* httpbinorg_03172020.cer */,
);
path = HTTPBin.org;
sourceTree = "<group>";
@ -435,7 +450,10 @@
298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */,
298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */,
298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */,
2D45638F1DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m */,
2D4563931DB11DDB00AE4812 /* AFXMLDocumentResponseSerializerTests.m */,
298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */,
E91164641DA6A7AE00DFFF56 /* AFPropertyListRequestSerializerTests.m */,
29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */,
1BF9F95F1C87832B00F1F35A /* AFImageResponseSerializerTests.m */,
298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */,
@ -481,7 +499,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 */,
);
@ -501,6 +519,7 @@
299522451BBF125A00859F49 /* AFNetworking */ = {
isa = PBXGroup;
children = (
1F083A4920364648004D80C7 /* AFCompatibilityMacros.h */,
299522461BBF125A00859F49 /* AFHTTPSessionManager.h */,
299522471BBF125A00859F49 /* AFHTTPSessionManager.m */,
299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */,
@ -573,6 +592,7 @@
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 */,
@ -597,6 +617,7 @@
2995225E1BBF125A00859F49 /* AFURLSessionManager.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 */,
@ -612,6 +633,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 */,
@ -626,6 +648,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 */,
@ -690,9 +713,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 */,
@ -703,9 +726,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 */ = {
@ -744,9 +767,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 */,
@ -757,7 +780,7 @@
);
dependencies = (
);
name = "AFNetworking OS X";
name = "AFNetworking macOS";
productName = "AFNetworking OS X";
productReference = 299522771BBF136400859F49 /* AFNetworking.framework */;
productType = "com.apple.product-type.framework";
@ -768,7 +791,7 @@
299522301BBF104D00859F49 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = AFNetworking;
TargetAttributes = {
2987B0A41BC408A200179A4C = {
@ -797,7 +820,7 @@
};
};
buildConfigurationList = 299522331BBF104D00859F49 /* Build configuration list for PBXProject "AFNetworking" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 6.3";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
@ -810,10 +833,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 */,
);
};
@ -833,21 +856,21 @@
files = (
2987B0DE1BC40AFB00179A4C /* foobar.com.cer in Resources */,
2987B0D61BC40AEC00179A4C /* ADNNetServerTrustChain in Resources */,
2987B0D91BC40AF300179A4C /* COMODO_RSA_Certification_Authority.cer in Resources */,
E2B10D90233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */,
1F8482C2220F386200718111 /* httpbinorg_03172020.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 */,
1FE783031C5857A200A73B7C /* httpbinorg_01192017.cer in Resources */,
E2B10D93233035100004E005 /* Amazon Root CA 1.cer in Resources */,
5F4323C01BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */,
5F4323CF1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */,
5F4323C31BF63741003B8749 /* google.com.cer in Resources */,
@ -858,12 +881,11 @@
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 */,
E2B10D8E233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */,
1F8482C0220F386200718111 /* httpbinorg_03172020.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 */,
@ -871,10 +893,11 @@
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 */,
1FE783011C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */,
E2B10D91233035100004E005 /* Amazon Root CA 1.cer in Resources */,
5F4323BE1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */,
5F4323CD1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */,
5F4323C11BF63741003B8749 /* google.com.cer in Resources */,
@ -885,12 +908,11 @@
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 */,
E2B10D8F233035100004E005 /* Starfield Services Root Certificate Authority - G2.cer in Resources */,
1F8482C1220F386200718111 /* httpbinorg_03172020.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 */,
@ -898,10 +920,11 @@
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 */,
1FE783021C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */,
E2B10D92233035100004E005 /* Amazon Root CA 1.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 */,
@ -970,6 +993,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;
};
@ -980,6 +1005,7 @@
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 */,
@ -993,6 +1019,7 @@
298D7C981BC2CA2500FD3B3E /* AFURLSessionManagerTests.m in Sources */,
297824AC1BC2DB450041C395 /* AFImageDownloaderTests.m in Sources */,
29F5EF031C47E64F008B976A /* AFUIWebViewTests.m in Sources */,
2D4563901DB1179D00AE4812 /* AFXMLParserResponseSerializerTests.m in Sources */,
298D7CD51BC2CAEC00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */,
298D7CD71BC2CAEF00FD3B3E /* AFJSONSerializationTests.m in Sources */,
298D7CDB1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */,
@ -1006,12 +1033,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 */,
);
@ -1079,7 +1109,7 @@
};
298D7C511BC2C7B200FD3B3E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 299522761BBF136400859F49 /* AFNetworking OS X */;
target = 299522761BBF136400859F49 /* AFNetworking macOS */;
targetProxy = 298D7C501BC2C7B200FD3B3E /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@ -1088,7 +1118,9 @@
2987B0B61BC408A200179A4C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = marker;
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1111,7 +1143,9 @@
2987B0B71BC408A200179A4C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1134,6 +1168,7 @@
2987B0B81BC408A200179A4C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ./Tests/Info.plist;
@ -1148,6 +1183,7 @@
2987B0B91BC408A200179A4C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ./Tests/Info.plist;
@ -1162,6 +1198,7 @@
298D7C431BC2C79500FD3B3E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "";
DEVELOPMENT_TEAM = "";
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch";
@ -1176,6 +1213,7 @@
298D7C441BC2C79500FD3B3E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "";
DEVELOPMENT_TEAM = "";
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch";
@ -1190,6 +1228,7 @@
298D7C531BC2C7B200FD3B3E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COMBINE_HIDPI_IMAGES = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch";
@ -1205,6 +1244,7 @@
298D7C541BC2C7B200FD3B3E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COMBINE_HIDPI_IMAGES = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch";
@ -1223,10 +1263,13 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
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;
@ -1236,10 +1279,14 @@
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;
@ -1297,10 +1344,13 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
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;
@ -1310,10 +1360,14 @@
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;
@ -1362,7 +1416,9 @@
299522421BBF104D00859F49 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = marker;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
@ -1371,7 +1427,6 @@
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;
@ -1384,7 +1439,9 @@
299522431BBF104D00859F49 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
@ -1393,7 +1450,6 @@
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;
@ -1408,6 +1464,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = marker;
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1431,6 +1488,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -1452,7 +1510,9 @@
2995227D1BBF136400859F49 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = marker;
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
@ -1477,7 +1537,9 @@
2995227E1BBF136400859F49 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_OBJC_WEAK = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
@ -1529,7 +1591,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 */,
@ -1565,7 +1627,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 */,

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -40,9 +40,9 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
enableAddressSanitizer = "YES"
codeCoverageEnabled = "YES"
enableAddressSanitizer = "YES">
shouldUseLaunchSchemeArgsEnv = "NO">
<Testables>
<TestableReference
skipped = "NO">
@ -69,6 +69,18 @@
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "HTTPBIN_BASE_URL"
value = "http://127.0.0.1:5000"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -16,7 +16,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "299522761BBF136400859F49"
BuildableName = "AFNetworking.framework"
BlueprintName = "AFNetworking OS X"
BlueprintName = "AFNetworking macOS"
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -26,16 +26,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "NO">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "298D7C491BC2C7B200FD3B3E"
BuildableName = "AFNetworking Mac OS X Tests.xctest"
BlueprintName = "AFNetworking Mac OS X Tests"
BuildableName = "AFNetworking macOS Tests.xctest"
BlueprintName = "AFNetworking macOS Tests"
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
<SkippedTests>
@ -50,10 +50,17 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "299522761BBF136400859F49"
BuildableName = "AFNetworking.framework"
BlueprintName = "AFNetworking OS X"
BlueprintName = "AFNetworking macOS"
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "HTTPBIN_BASE_URL"
value = "http://127.0.0.1:5000"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
@ -72,7 +79,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "299522761BBF136400859F49"
BuildableName = "AFNetworking.framework"
BlueprintName = "AFNetworking OS X"
BlueprintName = "AFNetworking macOS"
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
</MacroExpansion>
@ -90,7 +97,7 @@
BuildableIdentifier = "primary"
BlueprintIdentifier = "299522761BBF136400859F49"
BuildableName = "AFNetworking.framework"
BlueprintName = "AFNetworking OS X"
BlueprintName = "AFNetworking macOS"
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
</MacroExpansion>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -26,8 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
enableAddressSanitizer = "YES">
enableAddressSanitizer = "YES"
shouldUseLaunchSchemeArgsEnv = "NO">
<Testables>
<TestableReference
skipped = "NO">
@ -54,6 +54,18 @@
ReferencedContainer = "container:AFNetworking.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "HTTPBIN_BASE_URL"
value = "http://127.0.0.1:5000"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
@ -66,11 +78,11 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableThreadSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
enableThreadSanitizer = "YES"
stopOnEveryThreadSanitizerIssue = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -0,0 +1,43 @@
// AFCompatibilityMacros.h
// Copyright (c) 20112016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef AFCompatibilityMacros_h
#define AFCompatibilityMacros_h
#ifdef API_UNAVAILABLE
#define AF_API_UNAVAILABLE(x) API_UNAVAILABLE(x)
#else
#define AF_API_UNAVAILABLE(x)
#endif // API_UNAVAILABLE
#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 */

View File

@ -167,6 +167,25 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(nullable id)parameters
progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
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 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:uploadProgress:downloadProgress:completionHandler:
*/
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(nullable id)parameters
headers:(nullable NSDictionary <NSString *, NSString *> *)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;
@ -184,7 +203,24 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task))success
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
/**
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
headers:(nullable NSDictionary <NSString *, NSString *> *)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.
@ -214,6 +250,25 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
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 `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 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
headers:(nullable NSDictionary <NSString *, NSString *> *)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;
@ -249,6 +304,26 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
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 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:uploadProgress:downloadProgress:completionHandler:
*/
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
headers:(nullable NSDictionary <NSString *, NSString *> *)headers
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
@ -267,7 +342,24 @@ NS_ASSUME_NONNULL_BEGIN
- (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;
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
/**
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
headers:(nullable NSDictionary <NSString *, NSString *> *)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.
@ -282,7 +374,24 @@ NS_ASSUME_NONNULL_BEGIN
- (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;
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
/**
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
headers:(nullable NSDictionary <NSString *, NSString *> *)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.
@ -297,7 +406,24 @@ NS_ASSUME_NONNULL_BEGIN
- (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;
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;
/**
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
headers:(nullable NSDictionary <NSString *, NSString *> *)headers
success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;
@end

View File

@ -123,7 +123,7 @@
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
return [self GET:URLString parameters:parameters progress:nil success:success failure:failure];
return [self GET:URLString parameters:parameters headers:nil progress:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)GET:(NSString *)URLString
@ -133,16 +133,28 @@
failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
{
return [self GET:URLString parameters:parameters headers:nil progress:downloadProgress success:success failure:failure];
}
- (NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(id)parameters
headers:(nullable NSDictionary <NSString *, NSString *> *)headers
progress:(void (^)(NSProgress * _Nonnull))downloadProgress
success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
failure:(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;
}
@ -151,14 +163,23 @@
success:(void (^)(NSURLSessionDataTask *task))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) {
return [self HEAD:URLString parameters:parameters headers:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)HEAD:(NSString *)URLString
parameters:(id)parameters
headers:(NSDictionary<NSString *,NSString *> *)headers
success:(void (^)(NSURLSessionDataTask * _Nonnull))success
failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
{
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;
}
@ -167,7 +188,7 @@
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];
return [self POST:URLString parameters:parameters headers:nil progress:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)POST:(NSString *)URLString
@ -176,10 +197,20 @@
success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success
failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure];
return [self POST:URLString parameters:parameters headers:nil progress:uploadProgress success:success failure:failure];
}
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
headers:(nullable NSDictionary <NSString *, NSString *> *)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 headers:headers uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure];
[dataTask resume];
return dataTask;
}
@ -189,7 +220,7 @@
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];
return [self POST:URLString parameters:parameters headers:nil constructingBodyWithBlock:block progress:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)POST:(NSString *)URLString
@ -198,19 +229,32 @@
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
return [self POST:URLString parameters:parameters headers:nil constructingBodyWithBlock:block progress:uploadProgress success:success failure:failure];
}
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(id)parameters
headers:(NSDictionary<NSString *,NSString *> *)headers
constructingBodyWithBlock:(void (^)(id<AFMultipartFormData> _Nonnull))block
progress:(void (^)(NSProgress * _Nonnull))uploadProgress
success:(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 addValue:headers[headerField] forHTTPHeaderField:headerField];
}
if (serializationError) {
if (failure) {
dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
failure(nil, serializationError);
});
}
return nil;
}
__block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
if (error) {
if (failure) {
@ -222,9 +266,9 @@
}
}
}];
[task resume];
return task;
}
@ -233,10 +277,19 @@
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
return [self PUT:URLString parameters:parameters headers:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)PUT:(NSString *)URLString
parameters:(id)parameters
headers:(NSDictionary<NSString *,NSString *> *)headers
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure];
[dataTask resume];
return dataTask;
}
@ -245,10 +298,19 @@
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
return [self PATCH:URLString parameters:parameters headers:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)PATCH:(NSString *)URLString
parameters:(id)parameters
headers:(NSDictionary<NSString *,NSString *> *)headers
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters headers:headers uploadProgress:nil downloadProgress:nil success:success failure:failure];
[dataTask resume];
return dataTask;
}
@ -257,16 +319,26 @@
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure];
return [self DELETE:URLString parameters:parameters headers:nil success:success failure:failure];
}
- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
parameters:(id)parameters
headers:(NSDictionary<NSString *,NSString *> *)headers
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))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
headers:(NSDictionary <NSString *, NSString *> *)headers
uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress
downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress
success:(void (^)(NSURLSessionDataTask *, id))success
@ -274,6 +346,9 @@
{
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 addValue:headers[headerField] forHTTPHeaderField:headerField];
}
if (serializationError) {
if (failure) {
dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
@ -306,7 +381,7 @@
#pragma mark - NSObject
- (NSString *)description {
return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", [self class], self, [self.baseURL absoluteString], self.session, self.operationQueue];
return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue];
}
#pragma mark - NSSecureCoding

View File

@ -108,11 +108,14 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
/**
* Initializes an instance of a network reachability manager
*
* @return nil as this method is unavailable
* Unavailable initializer
*/
- (nullable instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
* Unavailable initializer
*/
- (instancetype)init NS_UNAVAILABLE;
///--------------------------------------------------
/// @name Starting & Stopping Reachability Monitoring

View File

@ -32,6 +32,7 @@ NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire
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);
}
@ -170,8 +172,11 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
return self;
}
- (instancetype)init NS_UNAVAILABLE
- (instancetype)init
{
@throw [NSException exceptionWithName:NSGenericException
reason:@"`-init` unavailable. Use `-initWithReachability:` instead"
userInfo:nil];
return nil;
}
@ -207,14 +212,15 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
}
__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;
};
SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL};

View File

@ -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 <NSData *> *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 <NSData *> *)pinnedCertificates;
///------------------------------

View File

@ -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,11 +58,8 @@ 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);
__Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out);
allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust);
@ -78,10 +73,6 @@ _out:
CFRelease(policy);
}
if (tempCertificates) {
CFRelease(tempCertificates);
}
if (allowedCertificate) {
CFRelease(allowedCertificate);
}
@ -167,17 +158,6 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
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 +166,8 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
}
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode {
return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]];
NSSet <NSData *> *defaultPinnedCertificates = [self certificatesInBundle:[NSBundle mainBundle]];
return [self policyWithPinningMode:pinningMode withPinnedCertificates:defaultPinnedCertificates];
}
+ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates {
@ -261,9 +242,6 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
}
switch (self.SSLPinningMode) {
case AFSSLPinningModeNone:
default:
return NO;
case AFSSLPinningModeCertificate: {
NSMutableArray *pinnedCertificates = [NSMutableArray array];
for (NSData *certificateData in self.pinnedCertificates) {
@ -299,6 +277,9 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
}
return trustedPublicKeyCount > 0;
}
default:
return NO;
}
return NO;
@ -326,7 +307,7 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
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;
}

View File

@ -217,12 +217,13 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
}];
[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;
#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]];
@ -312,7 +313,7 @@ static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerOb
- (void)setValue:(NSString *)value
forHTTPHeaderField:(NSString *)field
{
dispatch_barrier_async(self.requestHeaderModificationQueue, ^{
dispatch_barrier_sync(self.requestHeaderModificationQueue, ^{
[self.mutableHTTPRequestHeaders setValue:value forKey:field];
});
}
@ -334,7 +335,7 @@ forHTTPHeaderField:(NSString *)field
}
- (void)clearAuthorizationHeader {
dispatch_barrier_async(self.requestHeaderModificationQueue, ^{
dispatch_barrier_sync(self.requestHeaderModificationQueue, ^{
[self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"];
});
}
@ -571,7 +572,7 @@ forHTTPHeaderField:(NSString *)field
dispatch_sync(self.requestHeaderModificationQueue, ^{
[coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))];
});
[coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];
[coder encodeObject:@(self.queryStringSerializationStyle) forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))];
}
#pragma mark - NSCopying
@ -679,6 +680,11 @@ NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2;
return self;
}
- (void)setRequest:(NSMutableURLRequest *)request
{
_request = [request mutableCopy];
}
- (BOOL)appendPartWithFileURL:(NSURL *)fileURL
name:(NSString *)name
error:(NSError * __autoreleasing *)error
@ -1254,7 +1260,21 @@ typedef enum {
[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;
@ -1276,7 +1296,7 @@ typedef enum {
- (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
@ -1333,7 +1353,13 @@ typedef enum {
[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;
@ -1356,7 +1382,7 @@ typedef enum {
- (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))];
}

View File

@ -24,6 +24,11 @@
NS_ASSUME_NONNULL_BEGIN
/**
Recursively removes `NSNull` values from a JSON object.
*/
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,10 +62,7 @@ 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;
@property (nonatomic, assign) NSStringEncoding stringEncoding DEPRECATED_MSG_ATTRIBUTE("The string encoding is never used. AFHTTPResponseSerializer only validates status codes and content types but does not try to decode the received data in any way.");
/**
Creates and returns a serializer with default configuration.
@ -111,6 +113,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 +170,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;

View File

@ -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 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
return nil;
}
self.stringEncoding = NSUTF8StringEncoding;
self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];
self.acceptableContentTypes = nil;
@ -114,7 +114,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
BOOL responseIsValid = YES;
NSError *validationError = nil;
if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) {
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]] &&
!([response MIMEType] == nil && [data length] == 0)) {
@ -182,7 +182,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
}
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,23 +242,28 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
}
}
id responseObject = nil;
NSError *serializationError = nil;
// 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
BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]];
if (data.length > 0 && !isSpace) {
responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];
} else {
if (data.length == 0 || isSpace) {
return nil;
}
NSError *serializationError = nil;
id responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError];
if (self.removesKeysWithNullValues && responseObject) {
responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);
if (!responseObject)
{
if (error) {
*error = AFErrorWithUnderlyingError(serializationError, *error);
}
return nil;
}
if (error) {
*error = AFErrorWithUnderlyingError(serializationError, *error);
if (self.removesKeysWithNullValues) {
return AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions);
}
return responseObject;
@ -378,10 +383,14 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
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;
}
@ -458,15 +467,20 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
}
}
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;

View File

@ -25,6 +25,7 @@
#import "AFURLResponseSerialization.h"
#import "AFURLRequestSerialization.h"
#import "AFSecurityPolicy.h"
#import "AFCompatibilityMacros.h"
#if !TARGET_OS_WATCH
#import "AFNetworkReachabilityManager.h"
#endif
@ -64,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.
@ -195,7 +196,15 @@ NS_ASSUME_NONNULL_BEGIN
@param cancelPendingTasks Whether or not to cancel pending tasks.
*/
- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks;
- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks DEPRECATED_ATTRIBUTE;
/**
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 resetSession:(BOOL)resetSession;
///-------------------------
/// @name Running Data Tasks
@ -354,7 +363,7 @@ 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:`.
@ -377,6 +386,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;
#endif
///-------------------------------------------
/// @name Setting Data Task Delegate Callbacks
///-------------------------------------------
@ -414,7 +431,7 @@ NS_ASSUME_NONNULL_BEGIN
@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
@ -428,7 +445,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.
*/
@ -497,4 +514,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

View File

@ -38,14 +38,16 @@ static dispatch_queue_t url_session_manager_creation_queue() {
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 void url_session_manager_create_task_safely(dispatch_block_t _Nonnull block) {
if (block != NULL) {
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();
}
}
}
@ -80,6 +82,7 @@ NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamof
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";
@ -95,6 +98,9 @@ typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSes
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);
#endif
typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response);
typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask);
@ -118,6 +124,9 @@ typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id re
@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;
#endif
@property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading;
@property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock;
@property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock;
@ -148,11 +157,17 @@ typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id re
progress.pausingHandler = ^{
[weakTask suspend];
};
if ([progress respondsToSelector:@selector(setResumingHandler:)]) {
#if AF_CAN_USE_AT_AVAILABLE
if (@available(iOS 9, macOS 10.11, *))
#else
if ([progress respondsToSelector:@selector(setResumingHandler:)])
#endif
{
progress.resumingHandler = ^{
[weakTask resume];
};
}
[progress addObserver:self
forKeyPath:NSStringFromSelector(@selector(fractionCompleted))
options:NSKeyValueObservingOptionNew
@ -202,6 +217,14 @@ didCompleteWithError:(NSError *)error
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) {
@ -250,6 +273,14 @@ didCompleteWithError:(NSError *)error
}
}
#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics {
self.sessionTaskMetrics = metrics;
}
#endif
#pragma mark - NSURLSessionDataDelegate
- (void)URLSession:(__unused NSURLSession *)session
@ -294,15 +325,14 @@ expectedTotalBytes:(int64_t)expectedTotalBytes{
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];
}
}
@ -375,7 +405,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
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];
@ -449,12 +479,15 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
@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) 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;
#endif
@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse;
@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask;
@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData;
@ -485,8 +518,6 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
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];
@ -523,6 +554,19 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
#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];
}
@ -679,11 +723,18 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
#pragma mark -
- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks {
[self invalidateSessionCancelingTasks:cancelPendingTasks resetSession:NO];
}
- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession {
if (cancelPendingTasks) {
[self.session invalidateAndCancel];
} else {
[self.session finishTasksAndInvalidate];
}
if (resetSession) {
self.session = nil;
}
}
#pragma mark -
@ -738,17 +789,21 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
__block NSURLSessionUploadTask *uploadTask = nil;
url_session_manager_create_task_safely(^{
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
});
// uploadTask may be nil on iOS7 because uploadTaskWithRequest:fromFile: may return nil despite being documented as nonnull (https://devforums.apple.com/message/926113#926113)
if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {
for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {
uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL];
// uploadTask may be nil on iOS7 because uploadTaskWithRequest:fromFile: may return nil despite being documented as nonnull (https://devforums.apple.com/message/926113#926113)
if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) {
for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) {
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;
}
@ -832,9 +887,11 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
self.sessionDidReceiveAuthenticationChallenge = block;
}
#if !TARGET_OS_OSX
- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block {
self.didFinishEventsForBackgroundURLSession = block;
}
#endif
#pragma mark -
@ -858,6 +915,12 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
self.taskDidComplete = block;
}
#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
- (void)setTaskDidFinishCollectingMetricsBlock:(void (^)(NSURLSession * _Nonnull, NSURLSessionTask * _Nonnull, NSURLSessionTaskMetrics * _Nullable))block {
self.taskDidFinishCollectingMetrics = block;
}
#endif
#pragma mark -
- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block {
@ -893,7 +956,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
#pragma mark - NSObject
- (NSString *)description {
return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", [self class], self, self.session, self.operationQueue];
return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, self.session, self.operationQueue];
}
- (BOOL)respondsToSelector:(SEL)selector {
@ -903,9 +966,12 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
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];
}
@ -1025,9 +1091,9 @@ totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
{
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];
}
}
@ -1061,6 +1127,23 @@ didCompleteWithError:(NSError *)error
}
}
#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
- (void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics
{
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
@ -1123,6 +1206,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
}
}
#if !TARGET_OS_OSX
- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session {
if (self.didFinishEventsForBackgroundURLSession) {
dispatch_async(dispatch_get_main_queue(), ^{
@ -1130,6 +1214,7 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
});
}
}
#endif
#pragma mark - NSURLSessionDownloadDelegate
@ -1143,8 +1228,8 @@ didFinishDownloadingToURL:(NSURL *)location
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];
}

View File

@ -4,6 +4,96 @@ All notable changes to this project will be documented in this file.
---
## [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).
@ -173,7 +263,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
@ -183,7 +273,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
@ -225,10 +315,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.
@ -253,7 +343,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.
@ -280,7 +370,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.
@ -290,7 +380,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`.
@ -306,7 +396,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
@ -319,11 +409,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).
@ -1065,7 +1155,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)
@ -1769,7 +1859,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)
@ -1834,7 +1924,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
@ -1854,7 +1944,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)
@ -1899,7 +1989,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)
@ -1957,7 +2047,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)

97
CONTRIBUTING_CH.md Normal file
View File

@ -0,0 +1,97 @@
# 贡献指南
本文档包含有关为此项目做出贡献的信息和指南。
请在开始参加之前阅读。
**主题**
* [提问](#提问)
* [报告安全问题](#报告安全问题)
* [报告其他问题](#报告其他问题)
* [提交拉取请求](#提交拉取请求)
* [开发人员原产地证书](#开发人员原产地证书-1.1)
* [行为守则](#行为守则)
## 提问
我们不使用GitHub的论坛发表问题
对于任何非特定于项目本身的使用问题,
请直接在[Stack Overflow](https://stackoverflow.com)上询问。
通过此方法,你可以快速解决您的问题,
并且任何有相同问题的人可以找到答案。
这也使维护人员能够专注于为其他人改进项目。
## 报告安全问题
Alamofire Software Foundation 认真对待安全问题。
如果您发现任何关于安全的问题,请立即通知我们!
请**不要**公然公开发布问题,
而是将您的问题私下发送到<security@alamofire.org>
这将有于帮助确保发现的任何漏洞
可以[披露制度](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) 社区.
我们表彰和感激他们为促进项目合作所做的付出。*

View File

@ -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 = "<group>"; };
291BFDF21BB9E8C700FFB029 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
291BFDF71BB9E8C700FFB029 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -137,7 +137,7 @@
29E6F19F1BB9DD7300A4466C /* AFAppDotNetAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFAppDotNetAPIClient.m; sourceTree = "<group>"; };
29E6F1AB1BB9DDB600A4466C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
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 = "<group>"; };
29E6F1EC1BB9E37200A4466C /* TodayViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TodayViewController.m; sourceTree = "<group>"; };
@ -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 = "<group>";
};
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 = 0930;
TargetAttributes = {
291BFDB81BB9E85400FFB029 = {
CreatedOnToolsVersion = 7.1;
@ -528,6 +528,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
@ -537,10 +538,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 */,
);
};
@ -668,7 +669,7 @@
};
29E6F1F31BB9E37200A4466C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 29E6F1E51BB9E37200A4466C /* Today Extension Example */;
target = 29E6F1E51BB9E37200A4466C /* iOS Today Extension Example */;
targetProxy = 29E6F1F21BB9E37200A4466C /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@ -709,6 +710,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;
@ -757,6 +759,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;
@ -800,6 +803,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;
@ -849,6 +853,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;
@ -892,6 +897,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;
@ -921,12 +927,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;
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;
};
@ -941,6 +947,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;
@ -964,11 +971,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;
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;
};
@ -984,6 +991,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;
@ -1020,7 +1028,7 @@
SDKROOT = appletvos;
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
@ -1036,6 +1044,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;
@ -1064,7 +1073,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
@ -1074,12 +1083,66 @@
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_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_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;
};
@ -1092,6 +1155,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;
@ -1140,6 +1204,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;
@ -1181,6 +1246,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;
@ -1229,6 +1295,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;
@ -1284,7 +1351,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 */,
@ -1320,7 +1387,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 */,

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -42,6 +42,16 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "298D7C3A1BC2C79500FD3B3E"
BuildableName = "AFNetworking iOS Tests.xctest"
BlueprintName = "AFNetworking iOS Tests"
ReferencedContainer = "container:../AFNetworking.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
@ -30,8 +30,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29E6F1E51BB9E37200A4466C"
BuildableName = "Today Extension Example.appex"
BlueprintName = "Today Extension Example"
BuildableName = "iOS Today Extension Example.appex"
BlueprintName = "iOS Today Extension Example"
ReferencedContainer = "container:AFNetworking Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -57,6 +57,16 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "298D7C3A1BC2C79500FD3B3E"
BuildableName = "AFNetworking iOS Tests.xctest"
BlueprintName = "AFNetworking iOS Tests"
ReferencedContainer = "container:../AFNetworking.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "298D7C491BC2C7B200FD3B3E"
BuildableName = "AFNetworking Mac OS X Tests.xctest"
BlueprintName = "AFNetworking Mac OS X Tests"
BuildableName = "AFNetworking macOS Tests.xctest"
BlueprintName = "AFNetworking macOS Tests"
ReferencedContainer = "container:../AFNetworking.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -29,8 +29,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "291BFDE61BB9E8C700FFB029"
BuildableName = "OS X Example.app"
BlueprintName = "OS X Example"
BuildableName = "macOS Example.app"
BlueprintName = "macOS Example"
ReferencedContainer = "container:AFNetworking Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -42,13 +42,23 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "298D7C491BC2C7B200FD3B3E"
BuildableName = "AFNetworking macOS Tests.xctest"
BlueprintName = "AFNetworking macOS Tests"
ReferencedContainer = "container:../AFNetworking.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "291BFDE61BB9E8C700FFB029"
BuildableName = "OS X Example.app"
BlueprintName = "OS X Example"
BuildableName = "macOS Example.app"
BlueprintName = "macOS Example"
ReferencedContainer = "container:AFNetworking Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
@ -70,8 +80,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "291BFDE61BB9E8C700FFB029"
BuildableName = "OS X Example.app"
BlueprintName = "OS X Example"
BuildableName = "macOS Example.app"
BlueprintName = "macOS Example"
ReferencedContainer = "container:AFNetworking Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
@ -89,8 +99,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "291BFDE61BB9E8C700FFB029"
BuildableName = "OS X Example.app"
BlueprintName = "OS X Example"
BuildableName = "macOS Example.app"
BlueprintName = "macOS Example"
ReferencedContainer = "container:AFNetworking Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -42,6 +42,16 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2987B0AD1BC408A200179A4C"
BuildableName = "AFNetworking tvOS Tests.xctest"
BlueprintName = "AFNetworking tvOS Tests"
ReferencedContainer = "container:../AFNetworking.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -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;
};

View File

@ -2,79 +2,109 @@
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"size" : "29x29",
"scale" : "2x",
"filename" : "Icon-Small@2x.png"
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x",
"filename" : "Icon-Small@3x.png"
"idiom" : "iphone",
"filename" : "Icon-Small@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x",
"filename" : "Icon-40@2x.png"
"idiom" : "iphone",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x",
"filename" : "Icon-40@3x.png"
"idiom" : "iphone",
"filename" : "Icon-40@3x.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x",
"filename" : "Icon-60@2x.png"
},
{
"idiom" : "iphone",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"scale" : "3x",
"filename" : "Icon-60@3x.png"
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"size" : "29x29",
"scale" : "1x",
"filename" : "Icon-Small.png"
"idiom" : "ipad",
"filename" : "Icon-Small.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x",
"filename" : "Icon-Small@2x.png"
"idiom" : "ipad",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x",
"filename" : "Icon-40.png"
"idiom" : "ipad",
"filename" : "Icon-40.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x",
"filename" : "Icon-40@2x.png"
"idiom" : "ipad",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x",
"filename" : "Icon-76.png"
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x",
"filename" : "Icon-76@2x.png"
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "makeappicon"
"author" : "xcode"
}
}

View File

@ -50,7 +50,6 @@
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
[Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) {
if (!error) {
self.post = posts.firstObject;
[self savePost:self.post];

View File

@ -46,8 +46,10 @@
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];
}];
}

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9052" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9052"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13529"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@ -13,10 +15,10 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
<menuItem title="AFNetworking OS X Example" id="56">
<menu key="submenu" title="AFNetworking OS X Example" systemMenu="apple" id="57">
<menuItem title="AFNetworking macOS Example" id="56">
<menu key="submenu" title="AFNetworking macOS Example" systemMenu="apple" id="57">
<items>
<menuItem title="About AFNetworking OS X Example" id="58">
<menuItem title="About AFNetworking macOS Example" id="58">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
@ -31,7 +33,7 @@
<menuItem isSeparatorItem="YES" id="144">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Hide AFNetworking OS X Example" keyEquivalent="h" id="134">
<menuItem title="Hide AFNetworking macOS Example" keyEquivalent="h" id="134">
<connections>
<action selector="hide:" target="-1" id="367"/>
</connections>
@ -50,7 +52,7 @@
<menuItem isSeparatorItem="YES" id="149">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Quit AFNetworking OS X Example" keyEquivalent="q" id="136">
<menuItem title="Quit AFNetworking macOS Example" keyEquivalent="q" id="136">
<connections>
<action selector="terminate:" target="-3" id="449"/>
</connections>
@ -148,7 +150,7 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="491">
<items>
<menuItem title="AFNetworking OS X Example Help" keyEquivalent="?" id="492">
<menuItem title="AFNetworking macOS Example Help" keyEquivalent="?" id="492">
<connections>
<action selector="showHelp:" target="-1" id="493"/>
</connections>
@ -158,11 +160,11 @@
</menuItem>
</items>
</menu>
<window title="AFNetworking OS X Example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="371">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
<window title="AFNetworking macOS Example" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="371">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="60" y="295" width="331" height="500"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<value key="minSize" type="size" width="375" height="200"/>
<value key="maxSize" type="size" width="375" height="1280"/>
<view key="contentView" id="372">
@ -176,13 +178,13 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="85" rowSizeStyle="automatic" viewBased="YES" id="541">
<rect key="frame" x="0.0" y="0.0" width="331" height="0.0"/>
<rect key="frame" x="0.0" y="0.0" width="331" height="498"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="10" height="10"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="321" minWidth="70" maxWidth="10000" id="542">
<tableColumn identifier="" width="321" minWidth="70" maxWidth="10000" id="542">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@ -261,7 +263,6 @@
</tableColumns>
</tableView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="540">
<rect key="frame" x="1" y="484" width="373" height="15"/>

View File

@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -12,6 +12,12 @@
"filename" : "App Icon - Small.imagestack",
"role" : "primary-app-icon"
},
{
"size" : "2320x720",
"idiom" : "tv",
"filename" : "Top Shelf Image Wide.imageset",
"role" : "top-shelf-image-wide"
},
{
"size" : "1920x720",
"idiom" : "tv",
@ -23,4 +29,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

View File

@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -3,6 +3,10 @@
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {

View File

@ -1,5 +1,12 @@
{
"images" : [
{
"orientation" : "landscape",
"idiom" : "tv",
"extent" : "full-screen",
"minimum-system-version" : "11.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "tv",

View File

@ -39,7 +39,7 @@ private extension String {
hash += String(format: "%02x", result[i])
}
result.deallocate(capacity: digestLength)
result.deallocate()
return String(format: hash)
}

View File

@ -38,6 +38,7 @@ FOUNDATION_EXPORT const unsigned char AFNetworkingVersionString[];
#import <AFNetworking/AFURLRequestSerialization.h>
#import <AFNetworking/AFURLResponseSerialization.h>
#import <AFNetworking/AFSecurityPolicy.h>
#import <AFNetworking/AFCompatibilityMacros.h>
#if !TARGET_OS_WATCH
#import <AFNetworking/AFNetworkReachabilityManager.h>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<string>3.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.1.0</string>
<string>3.2.1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>

View File

@ -9,7 +9,7 @@
[![Platform](https://img.shields.io/cocoapods/p/AFNetworking.svg?style=flat)](http://cocoadocs.org/docsets/AFNetworking)
[![Twitter](https://img.shields.io/badge/twitter-@AFNetworking-blue.svg?style=flat)](http://twitter.com/AFNetworking)
AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
AFNetworking is a delightful networking library for iOS, macOS, watchOS, and tvOS. It's built on top of the [Foundation URL Loading System](https://developer.apple.com/documentation/foundation/url_loading_system), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
@ -83,7 +83,7 @@ Run `carthage` to build the framework and drag the built `AFNetworking.framework
## Requirements
| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | Minimum watchOS Target | Minimum tvOS Target | Notes |
| AFNetworking Version | Minimum iOS Target | Minimum macOS Target | Minimum watchOS Target | Minimum tvOS Target | Notes |
|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
| 3.x | iOS 7 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required. `NSURLConnectionOperation` support has been removed. |
| 2.6 -> 2.6.3 | iOS 7 | OS X 10.9 | watchOS 2.0 | n/a | Xcode 7+ is required. |
@ -91,7 +91,7 @@ Run `carthage` to build the framework and drag the built `AFNetworking.framework
| 1.x | iOS 5 | Mac OS X 10.7 | n/a | n/a |
| 0.10.x | iOS 4 | Mac OS X 10.6 | n/a | n/a |
(OS X projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
(macOS projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)).
> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs.
@ -112,7 +112,7 @@ Run `carthage` to build the framework and drag the built `AFNetworking.framework
- `AFHTTPResponseSerializer`
- `AFJSONResponseSerializer`
- `AFXMLParserResponseSerializer`
- `AFXMLDocumentResponseSerializer` _(Mac OS X)_
- `AFXMLDocumentResponseSerializer` _(macOS)_
- `AFPropertyListResponseSerializer`
- `AFImageResponseSerializer`
- `AFCompoundResponseSerializer`
@ -319,4 +319,4 @@ If you believe you have identified a security vulnerability with AFNetworking, y
## License
AFNetworking is released under the MIT license. See LICENSE for details.
AFNetworking is released under the MIT license. See [LICENSE](https://github.com/AFNetworking/AFNetworking/blob/master/LICENSE) for details.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -219,7 +219,7 @@
UInt64 postPurgeMemoryUsage = self.cache.memoryUsage;
XCTAssertTrue(postPurgeMemoryUsage < prePurgeMemoryUsage);
for (NSUInteger index = 0; index <= numberOfImages ; index++) {
for (NSUInteger index = 0; index <= numberOfImages; index++) {
NSString * identifier = [NSString stringWithFormat:@"image-%ld",(long)index];
UIImage *cachedImage = [self.cache imageWithIdentifier:identifier];
if (index == 0 || index >= 6) {
@ -230,4 +230,12 @@
}
}
#pragma mark - Should Cache Image
- (void)testThatShouldCacheIsYes {
NSURL *url = [NSURL URLWithString:@"http://test.com/image"];
NSString *identifier = @"filter";
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
BOOL result = [self.cache shouldCacheImage:self.testImage forRequest:request withAdditionalIdentifier:identifier];
XCTAssertTrue(result);
}
@end

View File

@ -71,8 +71,8 @@
XCTAssertNotNil(copiedSerializer);
XCTAssertNotEqual(compoundSerializer, copiedSerializer);
XCTAssertTrue(compoundSerializer.responseSerializers.count == copiedSerializer.responseSerializers.count);
XCTAssertTrue([NSStringFromClass([[copiedSerializer.responseSerializers objectAtIndex:0] class]) isEqualToString:NSStringFromClass([AFImageResponseSerializer class])]);
XCTAssertTrue([NSStringFromClass([[copiedSerializer.responseSerializers objectAtIndex:1] class]) isEqualToString:NSStringFromClass([AFJSONResponseSerializer class])]);
XCTAssertTrue([NSStringFromClass([copiedSerializer.responseSerializers[0] class]) isEqualToString:NSStringFromClass([AFImageResponseSerializer class])]);
XCTAssertTrue([NSStringFromClass([copiedSerializer.responseSerializers[1] class]) isEqualToString:NSStringFromClass([AFJSONResponseSerializer class])]);
XCTAssertEqual(compoundSerializer.acceptableStatusCodes, copiedSerializer.acceptableStatusCodes);
XCTAssertEqual(compoundSerializer.acceptableContentTypes, copiedSerializer.acceptableContentTypes);
}
@ -87,8 +87,8 @@
XCTAssertNotNil(unarchivedSerializer);
XCTAssertNotEqual(unarchivedSerializer, compoundSerializer);
XCTAssertTrue(compoundSerializer.responseSerializers.count == compoundSerializer.responseSerializers.count);
XCTAssertTrue([NSStringFromClass([[unarchivedSerializer.responseSerializers objectAtIndex:0] class]) isEqualToString:NSStringFromClass([AFImageResponseSerializer class])]);
XCTAssertTrue([NSStringFromClass([[unarchivedSerializer.responseSerializers objectAtIndex:1] class]) isEqualToString:NSStringFromClass([AFJSONResponseSerializer class])]);
XCTAssertTrue([NSStringFromClass([unarchivedSerializer.responseSerializers[0] class]) isEqualToString:NSStringFromClass([AFImageResponseSerializer class])]);
XCTAssertTrue([NSStringFromClass([unarchivedSerializer.responseSerializers[1] class]) isEqualToString:NSStringFromClass([AFJSONResponseSerializer class])]);
}
@end

View File

@ -169,7 +169,9 @@
NSError *serializerError = [NSError errorWithDomain:@"TestDomain" code:0 userInfo:nil];
[serializer setQueryStringSerializationWithBlock:^NSString *(NSURLRequest *request, NSDictionary *parameters, NSError *__autoreleasing *error) {
*error = serializerError;
if (error != NULL) {
*error = serializerError;
}
return nil;
}];

View File

@ -25,24 +25,25 @@
#import "AFSecurityPolicy.h"
@interface AFHTTPSessionManagerTests : AFTestCase
@property (readwrite, nonatomic, strong) AFHTTPSessionManager *manager;
@property (readwrite, nonatomic, strong) AFHTTPSessionManager *sessionManager;
@end
@implementation AFHTTPSessionManagerTests
- (void)setUp {
[super setUp];
self.manager = [[AFHTTPSessionManager alloc] initWithBaseURL:self.baseURL];
self.sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:self.baseURL];
}
- (void)tearDown {
[self.manager invalidateSessionCancelingTasks:YES];
[self.sessionManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.sessionManager = nil;
[super tearDown];
}
#pragma mark - init
- (void)testSharedManagerIsNotEqualToInitdManager {
XCTAssertFalse([[AFHTTPSessionManager manager] isEqual:self.manager]);
- (void)testSharedManagerIsNotEqualToInitedManager {
XCTAssertFalse([[AFHTTPSessionManager manager] isEqual:self.sessionManager]);
}
#pragma mark - misc
@ -54,7 +55,7 @@
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/get" relativeToURL:self.baseURL]];
NSURLSessionDataTask *task = [self.manager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil
NSURLSessionDataTask *task = [self.sessionManager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil
completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
blockResponseObject = responseObject;
blockError = error;
@ -76,7 +77,7 @@
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/status/404" relativeToURL:self.baseURL]];
NSURLSessionDataTask *task = [self.manager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil
NSURLSessionDataTask *task = [self.sessionManager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil
completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
blockError = error;
[expectation fulfill];
@ -97,13 +98,13 @@
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
NSURLRequest *redirectRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/redirect/1" relativeToURL:self.baseURL]];
NSURLSessionDataTask *redirectTask = [self.manager dataTaskWithRequest:redirectRequest uploadProgress:nil downloadProgress:nil
NSURLSessionDataTask *redirectTask = [self.sessionManager dataTaskWithRequest:redirectRequest uploadProgress:nil downloadProgress:nil
completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
blockError = error;
[expectation fulfill];
}];
[self.manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest *(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request) {
[self.sessionManager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest *(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request) {
if (response) {
success = YES;
}
@ -126,14 +127,14 @@
__block NSURL *downloadFilePath = nil;
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager setDownloadTaskDidFinishDownloadingBlock:^NSURL *(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location) {
[self.sessionManager setDownloadTaskDidFinishDownloadingBlock:^NSURL *(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location) {
managerDownloadFinishedBlockExecuted = YES;
NSURL *dirURL = [[[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject];
return [dirURL URLByAppendingPathComponent:@"t1.file"];
}];
NSURLSessionDownloadTask *downloadTask;
downloadTask = [self.manager
downloadTask = [self.sessionManager
downloadTaskWithRequest:[NSURLRequest requestWithURL:self.baseURL]
progress:nil
destination:nil
@ -155,7 +156,7 @@
__block NSURL *downloadFilePath = nil;
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
NSURLSessionDownloadTask *downloadTask = [self.manager downloadTaskWithRequest:[NSURLRequest requestWithURL:self.baseURL]
NSURLSessionDownloadTask *downloadTask = [self.sessionManager downloadTaskWithRequest:[NSURLRequest requestWithURL:self.baseURL]
progress:nil
destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
destinationBlockExecuted = YES;
@ -177,15 +178,18 @@
- (void)testThatSerializationErrorGeneratesErrorAndNullTaskForGET {
XCTestExpectation *expectation = [self expectationWithDescription:@"Serialization should fail"];
[self.manager.requestSerializer setQueryStringSerializationWithBlock:^NSString * _Nonnull(NSURLRequest * _Nonnull request, id _Nonnull parameters, NSError * _Nullable __autoreleasing * _Nullable error) {
*error = [NSError errorWithDomain:@"Custom" code:-1 userInfo:nil];
[self.sessionManager.requestSerializer setQueryStringSerializationWithBlock:^NSString * _Nonnull(NSURLRequest * _Nonnull request, id _Nonnull parameters, NSError * _Nullable __autoreleasing * _Nullable error) {
if (error != NULL) {
*error = [NSError errorWithDomain:@"Custom" code:-1 userInfo:nil];
}
return @"";
}];
NSURLSessionTask *nilTask;
nilTask = [self.manager
nilTask = [self.sessionManager
GET:@"test"
parameters:@{@"key":@"value"}
headers:nil
progress:nil
success:nil
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
@ -203,12 +207,12 @@
}
- (void)testCanBeEncoded {
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.manager];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.sessionManager];
XCTAssertNotNil(data);
}
- (void)testCanBeDecoded {
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.manager];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.sessionManager];
AFHTTPSessionManager *newManager = [NSKeyedUnarchiver unarchiveObjectWithData:data];
XCTAssertNotNil(newManager.securityPolicy);
XCTAssertNotNil(newManager.requestSerializer);
@ -221,7 +225,7 @@
#pragma mark - NSCopying
- (void)testCanBeCopied {
AFHTTPSessionManager *copyManager = [self.manager copy];
AFHTTPSessionManager *copyManager = [self.sessionManager copy];
XCTAssertNotNil(copyManager);
}
@ -229,9 +233,10 @@
- (void)testDownloadProgressIsReportedForGET {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
[self.manager
[self.sessionManager
GET:@"image"
parameters:nil
headers:nil
progress:^(NSProgress * _Nonnull downloadProgress) {
if (downloadProgress.fractionCompleted == 1.0) {
[expectation fulfill];
@ -239,7 +244,7 @@
}
success:nil
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testUploadProgressIsReportedForPOST {
@ -250,9 +255,10 @@
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
[self.manager
[self.sessionManager
POST:@"post"
parameters:payload
headers:nil
progress:^(NSProgress * _Nonnull uploadProgress) {
if (uploadProgress.fractionCompleted == 1.0) {
[expectation fulfill];
@ -260,7 +266,7 @@
}
success:nil
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testUploadProgressIsReportedForStreamingPost {
@ -271,7 +277,76 @@
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
[self.manager
[self.sessionManager
POST:@"post"
parameters:nil
headers:nil
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
[formData appendPartWithFileData:[payload dataUsingEncoding:NSUTF8StringEncoding] name:@"AFNetworking" fileName:@"AFNetworking" mimeType:@"text/html"];
}
progress:^(NSProgress * _Nonnull uploadProgress) {
if (uploadProgress.fractionCompleted == 1.0) {
[expectation fulfill];
}
}
success:nil
failure:nil];
[self waitForExpectationsWithCommonTimeout];
}
# pragma mark - Deprecated Progress
- (void)testDownloadProgressIsReportedForDeprecatedGET {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
GET:@"image"
parameters:nil
progress:^(NSProgress * _Nonnull downloadProgress) {
if (downloadProgress.fractionCompleted == 1.0) {
[expectation fulfill];
}
}
success:nil
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testUploadProgressIsReportedForDeprecatedPOST {
NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"];
while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) {
[payload appendString:@"AFNetworking"];
}
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
POST:@"post"
parameters:payload
progress:^(NSProgress * _Nonnull uploadProgress) {
if (uploadProgress.fractionCompleted == 1.0) {
[expectation fulfill];
}
}
success:nil
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testUploadProgressIsReportedForStreamingDeprecatedPost {
NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"];
while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) {
[payload appendString:@"AFNetworking"];
}
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
POST:@"post"
parameters:nil
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
@ -284,50 +359,54 @@
}
success:nil
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
# pragma mark - HTTP Status Codes
- (void)testThatSuccessBlockIsCalledFor200 {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
GET:@"status/200"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatFailureBlockIsCalledFor404 {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
GET:@"status/404"
parameters:nil
headers:nil
progress:nil
success:nil
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) {
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatResponseObjectIsEmptyFor204 {
__block id urlResponseObject = nil;
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
GET:@"status/204"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
urlResponseObject = responseObject;
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNil(urlResponseObject);
}
@ -335,50 +414,55 @@
- (void)testGET {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
GET:@"get"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertNotNil(responseObject);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testHEAD {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
HEAD:@"get"
parameters:nil
headers:nil
success:^(NSURLSessionDataTask * _Nonnull task) {
XCTAssertNotNil(task);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testPOST {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
POST:@"post"
parameters:@{@"key":@"value"}
headers:@{@"field":@"value"}
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testPOSTWithConstructingBody {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
POST:@"post"
parameters:@{@"key":@"value"}
headers:@{@"field":@"value"}
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
[formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding]
name:@"DataName"
@ -387,61 +471,68 @@
}
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]);
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testPUT {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
PUT:@"put"
parameters:@{@"key":@"value"}
headers:@{@"field":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDELETE {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
DELETE:@"delete"
parameters:@{@"key":@"value"}
headers:@{@"field":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
XCTAssertTrue([responseObject[@"args"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testPATCH {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.manager
[self.sessionManager
PATCH:@"patch"
parameters:@{@"key":@"value"}
headers:@{@"field":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([task.originalRequest.allHTTPHeaderFields[@"field"] isEqualToString:@"value"]);
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
#pragma mark - Deprecated Rest Interface
- (void)testDeprecatedGET {
- (void)testDeprecatedGETWithoutProgress {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.manager
[self.sessionManager
GET:@"get"
parameters:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
@ -450,14 +541,14 @@
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedPOST {
- (void)testDeprecatedPOSTWithoutProgress {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.manager
[self.sessionManager
POST:@"post"
parameters:@{@"key":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
@ -466,14 +557,14 @@
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedPOSTWithConstructingBody {
- (void)testDeprecatedPOSTWithoutProgressWithConstructingBody {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.manager
[self.sessionManager
POST:@"post"
parameters:@{@"key":@"value"}
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
@ -489,17 +580,141 @@
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedGETWithoutHeaders {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
GET:@"get"
parameters:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertNotNil(responseObject);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedHEADWithoutHeaders {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
HEAD:@"get"
parameters:nil
success:^(NSURLSessionDataTask * _Nonnull task) {
XCTAssertNotNil(task);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedPOSTWithoutHeaders {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
POST:@"post"
parameters:@{@"key":@"value"}
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedPOSTWithoutHeadersWithConstructingBody {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
POST:@"post"
parameters:@{@"key":@"value"}
constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
[formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding]
name:@"DataName"
fileName:@"DataFileName"
mimeType:@"data"];
}
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]);
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedPUTWithoutHeaders {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
PUT:@"put"
parameters:@{@"key":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedDELETEWithoutHeaders {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
DELETE:@"delete"
parameters:@{@"key":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([responseObject[@"args"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDeprecatedPATCHWithoutHeaders {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.sessionManager
PATCH:@"patch"
parameters:@{@"key":@"value"}
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]);
[expectation fulfill];
}
failure:nil];
#pragma clang diagnostic pop
[self waitForExpectationsWithCommonTimeout];
}
#pragma mark - Auth
- (void)testHiddenBasicAuthentication {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Request should finish"];
[self.manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"user" password:@"password"];
[self.manager
[self.sessionManager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"user" password:@"password"];
[self.sessionManager
GET:@"hidden-basic-auth/user/password"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[expectation fulfill];
@ -507,7 +722,7 @@
XCTFail(@"Request should succeed");
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
# pragma mark - Security Policy
@ -572,6 +787,7 @@
[manager
GET:@""
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTFail(@"Request should fail");
@ -582,8 +798,8 @@
XCTAssertEqual(error.code, NSURLErrorCancelled);
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[manager invalidateSessionCancelingTasks:YES];
[self waitForExpectationsWithCommonTimeout];
[manager invalidateSessionCancelingTasks:YES resetSession:NO];
}
- (void)testInvalidServerTrustProducesCorrectErrorForPublicKeyPinning {
@ -596,6 +812,7 @@
[manager
GET:@""
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
XCTFail(@"Request should fail");
@ -606,8 +823,8 @@
XCTAssertEqual(error.code, NSURLErrorCancelled);
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[manager invalidateSessionCancelingTasks:YES];
[self waitForExpectationsWithCommonTimeout];
[manager invalidateSessionCancelingTasks:YES resetSession:NO];
}
@end

View File

@ -22,6 +22,11 @@
#import "AFTestCase.h"
#import "AFImageDownloader.h"
@interface MockAFAutoPurgingImageCache : AFAutoPurgingImageCache
@property (nonatomic, strong) BOOL(^shouldCache)(UIImage*, NSURLRequest*, NSString*);
@property (nonatomic, strong) void(^addCache)(UIImage*, NSString*);
@end
@interface AFImageDownloaderTests : AFTestCase
@property (nonatomic, strong) NSURLRequest *pngRequest;
@property (nonatomic, strong) NSURLRequest *jpegRequest;
@ -40,7 +45,7 @@
}
- (void)tearDown {
[self.downloader.sessionManager invalidateSessionCancelingTasks:YES];
[self.downloader.sessionManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.downloader = nil;
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
@ -80,7 +85,7 @@
XCTAssertTrue(error.code == NSURLErrorBadURL);
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNil(downloadReceipt, @"downloadReceipt should be nil");
}
@ -99,7 +104,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(urlResponse, @"HTTPURLResponse should not be nil");
XCTAssertNotNil(responseImage, @"Response image should not be nil");
@ -132,7 +137,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(urlResponse1, @"HTTPURLResponse should not be nil");
XCTAssertNotNil(responseImage1, @"Respone image should not be nil");
@ -168,7 +173,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertEqual(urlResponse1, urlResponse2, @"responses should be equal");
XCTAssertEqual(responseImage2, responseImage2, @"responses should be equal");
@ -190,7 +195,7 @@
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(urlResponse);
XCTAssertNotNil(responseImage);
@ -211,7 +216,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"];
__block NSHTTPURLResponse *urlResponse2 = nil;
@ -226,7 +231,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(urlResponse1);
XCTAssertNotNil(responseImage1);
@ -234,6 +239,112 @@
XCTAssertEqual(responseImage1, responseImage2);
}
- (void)testThatImageCacheIsPromptedShouldCache {
XCTestExpectation *expectation3 = [self expectationWithDescription:@"image 1 shouldCache called"];
XCTestExpectation *expectation4 = [self expectationWithDescription:@"image 1 addCache called"];
MockAFAutoPurgingImageCache *mock = [[MockAFAutoPurgingImageCache alloc] init];
mock.shouldCache = ^BOOL(UIImage *img, NSURLRequest *req, NSString *iden) {
[expectation3 fulfill];
return YES;
};
mock.addCache = ^(UIImage *img, NSString *ident) {
[expectation4 fulfill];
};
self.downloader.imageCache = mock;
XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"];
__block NSHTTPURLResponse *urlResponse1 = nil;
__block UIImage *responseImage1 = nil;
[self.downloader
downloadImageForURLRequest:self.pngRequest
success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
urlResponse1 = response;
responseImage1 = responseObject;
[expectation1 fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeout];
XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"];
__block NSHTTPURLResponse *urlResponse2 = nil;
__block UIImage *responseImage2 = nil;
[self.downloader
downloadImageForURLRequest:self.pngRequest
success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
urlResponse2 = response;
responseImage2 = responseObject;
[expectation2 fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(urlResponse1);
XCTAssertNotNil(responseImage1);
XCTAssertNil(urlResponse2);
XCTAssertEqual(responseImage1, responseImage2);
}
- (void)testThatImageCacheIsPromptedShouldCacheNot {
XCTestExpectation *expectation3 = [self expectationWithDescription:@"image 1 shouldCache called"];
MockAFAutoPurgingImageCache *mock = [[MockAFAutoPurgingImageCache alloc] init];
mock.shouldCache = ^BOOL(UIImage *img, NSURLRequest *req, NSString *iden) {
[expectation3 fulfill];
return NO;
};
mock.addCache = ^(UIImage *img, NSString *ident) {
XCTFail(@"Not expected");
};
self.downloader.imageCache = mock;
XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"];
__block NSHTTPURLResponse *urlResponse1 = nil;
__block UIImage *responseImage1 = nil;
[self.downloader
downloadImageForURLRequest:self.pngRequest
success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
urlResponse1 = response;
responseImage1 = responseObject;
[expectation1 fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeout];
XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"];
__block NSHTTPURLResponse *urlResponse2 = nil;
__block UIImage *responseImage2 = nil;
XCTestExpectation *expectation5 = [self expectationWithDescription:@"image 2 shouldCache called"];
mock.shouldCache = ^BOOL(UIImage *img, NSURLRequest *req, NSString *iden) {
[expectation5 fulfill];
return NO;
};
[self.downloader
downloadImageForURLRequest:self.pngRequest
success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) {
urlResponse2 = response;
responseImage2 = responseObject;
[expectation2 fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(urlResponse1);
XCTAssertNotNil(responseImage1);
XCTAssertNotNil(urlResponse2);
XCTAssertNotEqual(responseImage1, responseImage2);
}
- (void)testThatImageDownloadReceiptIsNilForCachedImage {
XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"];
AFImageDownloadReceipt *receipt1;
@ -244,7 +355,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"];
@ -256,7 +367,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(receipt1);
XCTAssertNil(receipt2);
@ -277,7 +388,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"];
NSMutableURLRequest *alteredRequest = [self.pngRequest mutableCopy];
@ -295,7 +406,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(receipt1);
XCTAssertNotNil(receipt2);
@ -324,7 +435,7 @@
[expectation fulfill];
}];
[self.downloader cancelTaskForImageDownloadReceipt:receipt];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertTrue(responseError.code == NSURLErrorCancelled);
XCTAssertTrue([responseError.domain isEqualToString:NSURLErrorDomain]);
@ -355,7 +466,7 @@
[expectation2 fulfill];
}];
[self.downloader cancelTaskForImageDownloadReceipt:receipt];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertTrue(responseError.code == NSURLErrorCancelled);
XCTAssertTrue([responseError.domain isEqualToString:NSURLErrorDomain]);
@ -398,7 +509,7 @@
}];
}
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
#pragma mark - Threading
@ -412,7 +523,7 @@
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertTrue(successIsOnMainThread);
}
@ -427,7 +538,7 @@
failureIsOnMainThread = [[NSThread currentThread] isMainThread];
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertTrue(failureIsOnMainThread);
}
@ -445,3 +556,24 @@
}
@end
#pragma mark -
@implementation MockAFAutoPurgingImageCache
- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier {
if (self.shouldCache) {
return self.shouldCache(image, request, identifier);
}
else {
return [super shouldCacheImage:image forRequest:request withAdditionalIdentifier:identifier];
}
}
- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier{
[super addImage:image withIdentifier:identifier];
if (self.addCache) {
self.addCache(image, identifier);
}
}
@end

View File

@ -45,7 +45,7 @@ static NSData * AFJSONTestData() {
- (void)testThatJSONRequestSerializationHandlesParametersDictionary {
NSDictionary *parameters = @{@"key":@"value"};
NSError *error = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:AFNetworkingTestsBaseURLString parameters:parameters error:&error];
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:self.baseURL.absoluteString parameters:parameters error:&error];
XCTAssertNil(error, @"Serialization error should be nil");
@ -57,7 +57,7 @@ static NSData * AFJSONTestData() {
- (void)testThatJSONRequestSerializationHandlesParametersArray {
NSArray *parameters = @[@{@"key":@"value"}];
NSError *error = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:AFNetworkingTestsBaseURLString parameters:parameters error:&error];
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:self.baseURL.absoluteString parameters:parameters error:&error];
XCTAssertNil(error, @"Serialization error should be nil");
@ -66,6 +66,29 @@ static NSData * AFJSONTestData() {
XCTAssertTrue([@"[{\"key\":\"value\"}]" isEqualToString:body], @"Parameters were not encoded correctly");
}
- (void)testThatJSONRequestSerializationHandlesInvalidParameters {
NSString *string = [[NSString alloc] initWithBytes:"\xd8\x00" length:2 encoding:NSUTF16StringEncoding];
NSDictionary *parameters = @{@"key":string};
NSError *error = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:self.baseURL.absoluteString parameters:parameters error:&error];
XCTAssertNil(request, @"Expected nil request.");
XCTAssertNotNil(error, @"Expected non-nil error.");
}
- (void)testThatJSONRequestSerializationErrorsWithInvalidJSON {
NSDictionary *parameters = @{@"key":[NSSet setWithObject:@"value"]};
NSError *error = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:self.baseURL.absoluteString parameters:parameters error:&error];
XCTAssertNil(request, @"Request should be nil");
XCTAssertNotNil(error, @"Serialization error should be not nil");
XCTAssertEqualObjects(error.domain, AFURLRequestSerializationErrorDomain);
XCTAssertEqual(error.code, NSURLErrorCannotDecodeContentData);
XCTAssertEqualObjects(error.localizedFailureReason, @"The `parameters` argument is not valid JSON.");
}
@end
#pragma mark -
@ -154,7 +177,7 @@ static NSData * AFJSONTestData() {
- (void)testThatJSONRemovesKeysWithNullValues {
self.responseSerializer.removesKeysWithNullValues = YES;
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type":@"text/json"}];
NSData *data = [NSJSONSerialization dataWithJSONObject:@{@"key":@"value",@"nullkey":[NSNull null],@"array":@[@{@"subnullkey":[NSNull null]}]}
NSData *data = [NSJSONSerialization dataWithJSONObject:@{@"key":@"value",@"nullkey":[NSNull null],@"array":@[@{@"subnullkey":[NSNull null]}], @"arrayWithNulls": @[[NSNull null]]}
options:(NSJSONWritingOptions)0
error:nil];
@ -166,6 +189,7 @@ static NSData * AFJSONTestData() {
XCTAssertNotNil(responseObject[@"key"]);
XCTAssertNil(responseObject[@"nullkey"]);
XCTAssertNil(responseObject[@"array"][0][@"subnullkey"]);
XCTAssertEqualObjects(responseObject[@"arrayWithNulls"], @[]);
}
- (void)testThatJSONResponseSerializerCanBeCopied {

View File

@ -46,7 +46,8 @@
[super tearDown];
self.networkActivityIndicatorManager = nil;
[self.sessionManager invalidateSessionCancelingTasks:YES];
[self.sessionManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.sessionManager = nil;
}
#pragma mark -
@ -69,12 +70,13 @@
[self.sessionManager
GET:@"/delay/1"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
[requestExpectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatNetworkActivityIndicatorTurnsOnAndOffIndicatorWhenRequestFails {
@ -95,12 +97,13 @@
[self.sessionManager
GET:@"/status/404"
parameters:nil
headers:nil
progress:nil
success:nil
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[requestExpectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatVisibilityDelaysAreApplied {
@ -128,13 +131,14 @@
[self.sessionManager
GET:@"/delay/2"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
requestEndTime = CACurrentMediaTime();
[requestExpectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertTrue((indicatorVisbleTime - requestStartTime) > self.networkActivityIndicatorManager.activationDelay);
XCTAssertTrue((indicatorHiddenTime - requestEndTime) > self.networkActivityIndicatorManager.completionDelay);
}
@ -157,6 +161,7 @@
[self.sessionManager
GET:@"/delay/4"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
[requestExpectation fulfill];
@ -167,6 +172,7 @@
[self.sessionManager
GET:@"/delay/2"
parameters:nil
headers:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
@ -174,7 +180,7 @@
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}

View File

@ -23,6 +23,7 @@
#import "AFNetworkReachabilityManager.h"
#import <netinet/in.h>
#import <objc/message.h>
@interface AFNetworkReachabilityManagerTests : AFTestCase
@property (nonatomic, strong) AFNetworkReachabilityManager *addressReachability;
@ -47,6 +48,20 @@
[super tearDown];
}
- (void)testInitializerThrowsExceptionWhenCalled {
AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager alloc];
id (*custom_msgSend)(id, SEL) = (id(*)(id, SEL))objc_msgSend;
XCTAssertThrows(custom_msgSend(manager, @selector(init)));
}
- (void)testNewThrowsExceptionWhenCalled {
id (*custom_msgSend)(id, SEL) = (id(*)(id, SEL))objc_msgSend;
XCTAssertThrows(custom_msgSend([AFNetworkReachabilityManager class],
@selector(new)));
}
- (void)testAddressReachabilityStartsInUnknownState {
XCTAssertEqual(self.addressReachability.networkReachabilityStatus, AFNetworkReachabilityStatusUnknown,
@"Reachability should start in an unknown state");
@ -64,51 +79,40 @@
handler:^BOOL(NSNotification *note) {
AFNetworkReachabilityStatus status;
status = [note.userInfo[AFNetworkingReachabilityNotificationStatusItem] integerValue];
BOOL reachable = (status == AFNetworkReachabilityStatusReachableViaWiFi
|| status == AFNetworkReachabilityStatusReachableViaWWAN);
if (reachable) {
XCTAssert(reachable,
@"Expected network to be reachable but got '%@'",
AFStringFromNetworkReachabilityStatus(status));
XCTAssertEqual(reachable, manager.isReachable, @"Expected status to match 'isReachable'");
}
return reachable;
BOOL isReachable = (status == AFNetworkReachabilityStatusReachableViaWiFi
|| status == AFNetworkReachabilityStatusReachableViaWWAN);
return isReachable;
}];
[manager startMonitoring];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testAddressReachabilityNotification {
[self verifyReachabilityNotificationGetsPostedWithManager:self.addressReachability];
}
//Commenting out for Travis Stability
//- (void)testDomainReachabilityNotification {
// [self verifyReachabilityNotificationGetsPostedWithManager:self.domainReachability];
//}
- (void)testDomainReachabilityNotification {
[self verifyReachabilityNotificationGetsPostedWithManager:self.domainReachability];
}
- (void)verifyReachabilityStatusBlockGetsCalledWithManager:(AFNetworkReachabilityManager *)manager
{
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"reachability status change block gets called"];
__weak __block XCTestExpectation *expectation = [self expectationWithDescription:@"reachability status change block gets called"];
typeof(manager) __weak weakManager = manager;
[manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
BOOL reachable = (status == AFNetworkReachabilityStatusReachableViaWiFi
|| status == AFNetworkReachabilityStatusReachableViaWWAN);
XCTAssert(reachable, @"Expected network to be reachable but got '%@'", AFStringFromNetworkReachabilityStatus(status));
XCTAssertEqual(reachable, weakManager.isReachable, @"Expected status to match 'isReachable'");
[expectation fulfill];
BOOL isReachable = (status == AFNetworkReachabilityStatusReachableViaWiFi
|| status == AFNetworkReachabilityStatusReachableViaWWAN);
if (isReachable) {
[expectation fulfill];
expectation = nil;
}
}];
[manager startMonitoring];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[manager setReachabilityStatusChangeBlock:nil];
}
@ -117,9 +121,21 @@
[self verifyReachabilityStatusBlockGetsCalledWithManager:self.addressReachability];
}
//Commenting out for Travis Stability
//- (void)testDomainReachabilityBlock {
// [self verifyReachabilityStatusBlockGetsCalledWithManager:self.domainReachability];
//}
- (void)testDomainReachabilityBlock {
[self verifyReachabilityStatusBlockGetsCalledWithManager:self.domainReachability];
}
- (void)testObjectPostingReachabilityManagerNotification {
[self expectationForNotification:AFNetworkingReachabilityDidChangeNotification
object:self.domainReachability
handler:^BOOL(NSNotification *notification) {
BOOL isObjectPostingNotification = [notification.object isEqual:self.domainReachability];
return isObjectPostingNotification;
}];
[self.domainReachability startMonitoring];
[self waitForExpectationsWithCommonTimeout];
}
@end

View File

@ -0,0 +1,56 @@
// AFPropertyListRequestSerializerTests.m
// Copyright (c) 20112016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AFTestCase.h"
#import "AFURLRequestSerialization.h"
@interface AFPropertyListRequestSerializerTests : AFTestCase
@property (nonatomic, strong) AFPropertyListRequestSerializer *requestSerializer;
@end
@implementation AFPropertyListRequestSerializerTests
- (void)setUp {
[super setUp];
self.requestSerializer = [AFPropertyListRequestSerializer serializer];
}
#pragma mark -
- (void)testThatPropertyListRequestSerializerAcceptsPlist {
NSDictionary *parameters = @{@"key":@"value"};
NSError *error = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:self.baseURL.absoluteString parameters:parameters error:&error];
XCTAssertNotNil(request, @"Expected non-nil request.");
}
- (void)testThatPropertyListRequestSerializerHandlesInvalidPlist {
NSDictionary *parameters = @{@42:@"value"};
NSError *error = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:self.baseURL.absoluteString parameters:parameters error:&error];
XCTAssertNil(request, @"Expected nil request.");
XCTAssertNotNil(error, @"Expected non-nil error.");
}
@end

View File

@ -36,6 +36,27 @@
#pragma mark -
- (void)testThatPropertyListResponseSerializerAcceptsPlistData {
NSData *data = [NSPropertyListSerialization dataWithPropertyList:@{@"foo": @"bar"} format:NSPropertyListXMLFormat_v1_0 options:0 error:NULL];
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/x-plist"}];
NSError *error = nil;
id responseObject = [self.responseSerializer responseObjectForResponse:response data:data error:&error];
XCTAssertTrue([responseObject isKindOfClass:[NSDictionary class]], @"Expected valid dictionary.");
}
- (void)testThatPropertyListResponseSerializerHandlesInvalidPlistData {
NSData *data = [NSJSONSerialization dataWithJSONObject:@{@"foo": @"bar"} options:(NSJSONWritingOptions)0 error:nil];
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/x-plist"}];
NSError *error = nil;
id responseObject = [self.responseSerializer responseObjectForResponse:response data:data error:&error];
XCTAssertNil(responseObject, @"Expected nil responseObject.");
XCTAssertNotNil(error, @"Expected non-nil error.");
}
- (void)testThatPropertyListResponseSerializerHandles204 {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:204 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/x-plist"}];
NSError *error;

View File

@ -32,7 +32,7 @@ static SecTrustRef AFUTTrustChainForCertsInDirectory(NSString *directoryPath) {
for (NSString *path in certFileNames) {
NSData *certData = [NSData dataWithContentsOfFile:[directoryPath stringByAppendingPathComponent:path]];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
[certs addObject:(__bridge id)(cert)];
[certs addObject:(__bridge_transfer id)(cert)];
}
SecPolicyRef policy = SecPolicyCreateBasicX509();
@ -57,68 +57,38 @@ static SecTrustRef AFUTADNNetServerTrust() {
return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath);
}
//static SecTrustRef AFUTGoogleComServerTrustPath1() {
// NSString *bundlePath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] resourcePath];
// NSString *serverCertDirectoryPath = [bundlePath stringByAppendingPathComponent:@"GoogleComServerTrustChainPath1"];
//
// return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath);
//}
//
//static SecTrustRef AFUTGoogleComServerTrustPath2() {
// NSString *bundlePath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] resourcePath];
// NSString *serverCertDirectoryPath = [bundlePath stringByAppendingPathComponent:@"GoogleComServerTrustChainPath2"];
//
// return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath);
//}
static SecCertificateRef AFUTHTTPBinOrgCertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"httpbinorg_01192017" ofType:@"cer"];
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"httpbinorg_03172020" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
NSData *certData = [NSData dataWithContentsOfFile:certPath];
return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
}
static SecCertificateRef AFUTCOMODORSADomainValidationSecureServerCertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"COMODO_RSA_Domain_Validation_Secure_Server_CA" ofType:@"cer"];
static SecCertificateRef AFUTAmazonAuthorityCertificate() {
NSString *certPath = [[NSBundle bundleForClass:NSClassFromString(@"AFSecurityPolicyTests")] pathForResource:@"Amazon" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
NSData *certData = [NSData dataWithContentsOfFile:certPath];
return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
}
static SecCertificateRef AFUTAmazonRootAuthorityCertificate() {
NSString *certPath = [[NSBundle bundleForClass:NSClassFromString(@"AFSecurityPolicyTests")] pathForResource:@"Amazon Root CA 1" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
NSData *certData = [NSData dataWithContentsOfFile:certPath];
return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
}
static SecCertificateRef AFUTCOMODORSACertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"COMODO_RSA_Certification_Authority" ofType:@"cer"];
static SecCertificateRef AFUTStarfieldServicesRootCertificate() {
NSString *certPath = [[NSBundle bundleForClass:NSClassFromString(@"AFSecurityPolicyTests")] pathForResource:@"Starfield Services Root Certificate Authority - G2" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
NSData *certData = [NSData dataWithContentsOfFile:certPath];
return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
}
static SecCertificateRef AFUTAddTrustExternalRootCertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"AddTrust_External_CA_Root" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
NSData *certData = [NSData dataWithContentsOfFile:certPath];
return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
}
//static SecCertificateRef AFUTGoogleComEquifaxSecureCARootCertificate() {
// NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"Equifax_Secure_Certificate_Authority_Root" ofType:@"cer"];
// NSCAssert(certPath != nil, @"Path for certificate should not be nil");
// NSData *certData = [NSData dataWithContentsOfFile:certPath];
//
// return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
//}
//
//static SecCertificateRef AFUTGoogleComGeoTrustGlobalCARootCertificate() {
// NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"GeoTrust_Global_CA_Root" ofType:@"cer"];
// NSCAssert(certPath != nil, @"Path for certificate should not be nil");
// NSData *certData = [NSData dataWithContentsOfFile:certPath];
//
// return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData));
//}
static SecCertificateRef AFUTSelfSignedCertificateWithoutDomain() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"NoDomains" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
@ -239,58 +209,50 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate1CertificatePinned {
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediateCertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate2CertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTCOMODORSACertificate();
SecCertificateRef certificate = AFUTAmazonAuthorityCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgRootCertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef certificate = AFUTAmazonRootAuthorityCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithEntireCertificateChainPinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate();
SecCertificateRef intermedaite1Certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
SecCertificateRef intermedaite2Certificate = AFUTCOMODORSACertificate();
SecCertificateRef rootCertificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef intermediateCertificate = AFUTAmazonAuthorityCertificate();
SecCertificateRef intermediateCertificate2 = AFUTAmazonRootAuthorityCertificate();
SecCertificateRef rootCertificate = AFUTStarfieldServicesRootCertificate();
[policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite1Certificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite2Certificate),
(__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate), nil]];
(__bridge_transfer NSData *)SecCertificateCopyData(intermediateCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermediateCertificate2),
(__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate), nil]];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid");
}
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBirnOrgServerTrustWithHTTPbinOrgPinnedCertificateAndAdditionalPinnedCertificates {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate();
SecCertificateRef selfSignedCertificate = AFUTSelfSignedCertificateWithCommonNameDomain();
[policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]];
(__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid");
}
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinnedAndValidDomainName {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTHTTPBinOrgCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"httpbin.org"], @"Policy should allow server trust");
@ -361,96 +323,55 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate1CertificatePinned {
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediateCertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate2CertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTCOMODORSACertificate();
SecCertificateRef certificate = AFUTAmazonAuthorityCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgRootCertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef certificate = AFUTAmazonRootAuthorityCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithEntireCertificateChainPinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate();
SecCertificateRef intermedaite1Certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
SecCertificateRef intermedaite2Certificate = AFUTCOMODORSACertificate();
SecCertificateRef rootCertificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef intermediateCertificate = AFUTAmazonAuthorityCertificate();
SecCertificateRef intermediateCertificate2 = AFUTAmazonRootAuthorityCertificate();
SecCertificateRef rootCertificate = AFUTStarfieldServicesRootCertificate();
[policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite1Certificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite2Certificate),
(__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate), nil]];
(__bridge_transfer NSData *)SecCertificateCopyData(intermediateCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermediateCertificate2),
(__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate), nil]];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid");
}
- (void)testPolicyWithCertificatePinningAllowsHTTPBirnOrgServerTrustWithHTTPbinOrgPinnedCertificateAndAdditionalPinnedCertificates {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate();
SecCertificateRef selfSignedCertificate = AFUTSelfSignedCertificateWithCommonNameDomain();
[policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]];
(__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid");
}
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinnedAndValidDomainName {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTHTTPBinOrgCertificate();
policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"httpbin.org"], @"Policy should allow server trust");
}
//- (void)testPolicyWithCertificatePinningAllowsGoogleComServerTrustIncompleteChainWithRootCertificatePinnedAndValidDomainName {
// //TODO THIS TEST HAS BEEN DISABLED UNTIL CERTS HAVE BEEN UPDATED.
// //Please see conversation here: https://github.com/AFNetworking/AFNetworking/pull/3159#issuecomment-178647437
// //
// // Fix certificate validation for servers providing incomplete chains (#3159) - test case
// //
// // google.com has two certification paths and both send incomplete certificate chains, i.e. don't include the Root CA
// // (this can be validated in https://www.ssllabs.com/ssltest/analyze.html?d=google.com)
// //
// // The two certification paths are:
// // - Path 1: *.google.com, Google Internet Authority G2 (with GeoTrust Global CA Root)
// // - Path 2: *.google.com, Google Internet Authority G2, GeoTrust Global CA (cross signed) (with Equifax Secure CA Root)
// //
// // The common goal of using certificate pinning is to prevent MiTM (man-in-the-middle) attacks, so the Root CA's should be pinned to protect the entire chains.
// // Since there's no Root CA being sent, when `-evaluateServerTrust:` invokes `AFCertificateTrustChainForServerTrust(serverTrust)`, the Root CA isn't present
// // Therefore, even though `AFServerTrustIsValid(serverTrust)` succeeds, the next validation fails since no pinned certificate matches the `pinnedCertificates`.
// // By fetching the `AFCertificateTrustChainForServerTrust(serverTrust)` *after* the `AFServerTrustIsValid(serverTrust)` validation, the complete chain is obtained and the Root CA's match.
//
// AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
//
// // certification path 1
// SecCertificateRef certificate = AFUTGoogleComGeoTrustGlobalCARootCertificate();
// policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
//
// XCTAssertTrue([policy evaluateServerTrust:AFUTGoogleComServerTrustPath1() forDomain:@"google.com"], @"Policy should allow server trust");
//
// // certification path 2
// certificate = AFUTGoogleComEquifaxSecureCARootCertificate();
// policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)];
//
// XCTAssertTrue([policy evaluateServerTrust:AFUTGoogleComServerTrustPath2() forDomain:@"google.com"], @"Policy should allow server trust");
//}
#pragma mark Negative Server Trust Evaluation Tests
- (void)testPolicyWithCertificatePinningAndNoPinnedCertificatesDoesNotAllowHTTPBinOrgServerTrust {
@ -494,11 +415,6 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"invalid.org"], @"Policy should allow server trust because domain name validation is disabled");
}
- (void)testThatPolicyWithDomainNameValidationAllowsServerTrustWithValidWildcardDomainName {
AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"test.httpbin.org"], @"Policy should allow server trust");
}
- (void)testThatPolicyWithDomainNameValidationAndSelfSignedCommonNameCertificateAllowsServerTrust {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];

View File

@ -21,8 +21,6 @@
#import <XCTest/XCTest.h>
extern NSString * const AFNetworkingTestsBaseURLString;
@interface AFTestCase : XCTestCase
@property (nonatomic, strong, readonly) NSURL *baseURL;
@ -33,6 +31,7 @@ extern NSString * const AFNetworkingTestsBaseURLString;
@property (nonatomic, assign) NSTimeInterval networkTimeout;
- (void)waitForExpectationsWithCommonTimeout;
- (void)waitForExpectationsWithCommonTimeoutUsingHandler:(XCWaitCompletionHandler)handler;
@end

View File

@ -21,8 +21,6 @@
#import "AFTestCase.h"
NSString * const AFNetworkingTestsBaseURLString = @"https://httpbin.org/";
@implementation AFTestCase
- (void)setUp {
@ -37,7 +35,8 @@ NSString * const AFNetworkingTestsBaseURLString = @"https://httpbin.org/";
#pragma mark -
- (NSURL *)baseURL {
return [NSURL URLWithString:AFNetworkingTestsBaseURLString];
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
return [NSURL URLWithString:environment[@"HTTPBIN_BASE_URL"] ?: @"https://httpbin.org"];
}
- (NSURL *)pngURL {
@ -56,6 +55,10 @@ NSString * const AFNetworkingTestsBaseURLString = @"https://httpbin.org/";
return [self.baseURL URLByAppendingPathComponent:[NSString stringWithFormat:@"status/%@", @(statusCode)]];
}
- (void)waitForExpectationsWithCommonTimeout {
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
}
- (void)waitForExpectationsWithCommonTimeoutUsingHandler:(XCWaitCompletionHandler)handler {
[self waitForExpectationsWithTimeout:self.networkTimeout handler:handler];
}

View File

@ -40,7 +40,7 @@
- (void)tearDown {
[super tearDown];
[self.sessionManager invalidateSessionCancelingTasks:YES];
[self.sessionManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.sessionManager = nil;
}
@ -59,7 +59,7 @@
self.activityIndicatorView = nil;
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[task cancel];
}
@ -84,7 +84,7 @@
self.activityIndicatorView = nil;
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[task cancel];
}
@ -110,7 +110,7 @@
[task resume];
[task suspend];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[task cancel];
}

View File

@ -66,7 +66,7 @@
evaluatedWithObject:self.button
handler:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatForegroundImageCanBeCancelledAndDownloadedImmediately {
@ -84,7 +84,7 @@
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(responseImage);
}
@ -103,7 +103,7 @@
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(responseImage);
}

View File

@ -61,7 +61,7 @@
[self expectationForPredicate:[NSPredicate predicateWithFormat:@"image != nil"]
evaluatedWithObject:self.imageView
handler:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatImageDownloadSucceedsWhenDuplicateRequestIsSentToImageView {
@ -71,7 +71,7 @@
[self expectationForPredicate:[NSPredicate predicateWithFormat:@"image != nil"]
evaluatedWithObject:self.imageView
handler:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testThatPlaceholderImageIsSetIfRequestFails {
@ -84,7 +84,7 @@
failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertEqual(self.imageView.image, placeholder);
}
@ -99,7 +99,7 @@
[cacheExpectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
__block UIImage *cachedImage = nil;
__block NSHTTPURLResponse *urlResponse;
@ -113,7 +113,7 @@
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNil(urlResponse);
XCTAssertNotNil(cachedImage);
XCTAssertEqual(cachedImage, downloadImage);
@ -133,10 +133,34 @@
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
XCTAssertNotNil(responseImage);
}
- (void)testThatImageDownloadFailsWhenUsingMalformedURLRequest {
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should fail"];
UIImage *placeholder = [UIImage imageNamed:@"logo"];
__block NSURLRequest *failureRequest;
__block NSHTTPURLResponse *failureResponse;
__block NSError *failureError;
NSString *nilString;
NSURLRequest *malformedRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:nilString]];
[self.imageView setImageWithURLRequest:malformedRequest
placeholderImage:placeholder
success:nil
failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) {
failureRequest = request;
failureResponse = response;
failureError = error;
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeout];
XCTAssertEqual(self.imageView.image, placeholder);
XCTAssertEqual(failureRequest, malformedRequest);
XCTAssertNil(failureResponse);
XCTAssertNotNil(failureError);
}
- (void)testThatNilURLDoesntCrash {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"

View File

@ -40,7 +40,7 @@
- (void)tearDown {
[super tearDown];
[self.sessionManager invalidateSessionCancelingTasks:YES];
[self.sessionManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.sessionManager = nil;
}
@ -59,7 +59,7 @@
self.refreshControl = nil;
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[task cancel];
}
@ -83,7 +83,7 @@
self.refreshControl = nil;
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[task cancel];
}
@ -109,7 +109,7 @@
[task resume];
[task suspend];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
[task cancel];
}

View File

@ -24,6 +24,7 @@
#import "UIWebView+AFNetworking.h"
@interface AFUIWebViewTests : AFTestCase
@property (nonatomic, strong) UIWebView *webView;
@property (nonatomic, strong) NSURLRequest *HTMLRequest;
@ -47,7 +48,7 @@
return HTML;
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testNULLProgressDoesNotCauseCrash {
@ -60,26 +61,44 @@
return HTML;
}
failure:nil];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testProgressIsSet {
NSProgress* progress = nil;
//- (void)testProgressIsSet {
// NSProgress* progress = nil;
// XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
// [self.webView
// loadRequest:self.HTMLRequest
// progress:&progress
// success:^NSString * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSString * _Nonnull HTML) {
// [expectation fulfill];
// return HTML;
// }
// failure:nil];
// [self keyValueObservingExpectationForObject:progress
// keyPath:@"fractionCompleted"
// expectedValue:@(1.0)];
// [self waitForExpectationsWithCommonTimeout];
//}
- (void)testRequestWithCustomHeaders {
NSMutableURLRequest *customHeaderRequest = [NSMutableURLRequest requestWithURL:[self.baseURL URLByAppendingPathComponent:@"headers"]];
[customHeaderRequest setValue:@"Custom-Header-Value" forHTTPHeaderField:@"Custom-Header-Field"];
XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"];
[self.webView
loadRequest:self.HTMLRequest
progress:&progress
success:^NSString * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSString * _Nonnull HTML) {
loadRequest:customHeaderRequest
progress:NULL
success:^NSString * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSString * _Nonnull string) {
// Here string is actually JSON.
NSDictionary<NSString *, NSDictionary *> *responseObject = [NSJSONSerialization JSONObjectWithData:[string dataUsingEncoding:NSUTF8StringEncoding] options:(NSJSONReadingOptions)0 error:nil];
NSDictionary<NSString *, NSString *> *headers = responseObject[@"headers"];
XCTAssertTrue([headers[@"Custom-Header-Field"] isEqualToString:@"Custom-Header-Value"]);
[expectation fulfill];
return HTML;
return string;
}
failure:nil];
[self keyValueObservingExpectationForObject:progress
keyPath:@"fractionCompleted"
expectedValue:@(1.0)];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
@end

View File

@ -37,7 +37,6 @@
@property (readwrite, nonatomic, strong) AFURLSessionManager *backgroundManager;
@end
@implementation AFURLSessionManagerTests
- (NSURLRequest *)bigImageURLRequest {
@ -71,10 +70,10 @@
- (void)tearDown {
[super tearDown];
[self.localManager.session.configuration.URLCache removeAllCachedResponses];
[self.localManager invalidateSessionCancelingTasks:YES];
[self.localManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.localManager = nil;
[self.backgroundManager invalidateSessionCancelingTasks:YES];
[self.backgroundManager invalidateSessionCancelingTasks:YES resetSession:NO];
self.backgroundManager = nil;
}
@ -95,7 +94,7 @@
completionHandler:nil];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDataTaskDownloadProgressCanBeKVOd {
@ -115,7 +114,7 @@
return new == 1.0 && old != 0.0;
}];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testDownloadTaskDoesReportProgress {
@ -131,7 +130,47 @@
destination:nil
completionHandler:nil];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testSessionTaskDoesReportMetrics {
[self expectationForNotification:AFNetworkingTaskDidCompleteNotification object:nil handler:^BOOL(NSNotification * _Nonnull notification) {
#if AF_CAN_USE_AT_AVAILABLE && AF_CAN_INCLUDE_SESSION_TASK_METRICS
if (@available(iOS 10, macOS 10.12, watchOS 3, tvOS 10, *)) {
return [notification userInfo][AFNetworkingTaskDidCompleteSessionTaskMetrics] != nil;
}
#endif
return YES;
}];
#if AF_CAN_INCLUDE_SESSION_TASK_METRICS
__weak XCTestExpectation *metricsBlock = [self expectationWithDescription:@"Metrics completion block is called"];
[self.localManager setTaskDidFinishCollectingMetricsBlock:^(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSURLSessionTaskMetrics * _Nullable metrics) {
[metricsBlock fulfill];
}];
#endif
NSURLSessionTask *task = [self.localManager downloadTaskWithRequest:[self bigImageURLRequest]
progress:nil
destination:nil
completionHandler:nil];
[task resume];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testSessionIsStillValid {
NSURLSession *session = self.localManager.session;
[self.localManager invalidateSessionCancelingTasks:YES resetSession:NO];
XCTAssertEqual(session, self.localManager.session);
}
- (void)testSessionRecreatesAgain {
[self.localManager invalidateSessionCancelingTasks:YES resetSession:YES];
XCTAssertNotNil(self.localManager.session);
}
- (void)testUploadTaskDoesReportProgress {
@ -158,7 +197,7 @@
}
completionHandler:nil];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
- (void)testUploadProgressCanBeKVOd {
@ -182,7 +221,7 @@
[self keyValueObservingExpectationForObject:uploadProgress keyPath:NSStringFromSelector(@selector(fractionCompleted)) expectedValue:@(1.0)];
[task resume];
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
#pragma mark - rdar://17029580
@ -210,7 +249,7 @@
[expectation fulfill];
});
}
[self waitForExpectationsWithCommonTimeoutUsingHandler:nil];
[self waitForExpectationsWithCommonTimeout];
}
#pragma mark - Issue #2702 Tests
@ -459,7 +498,7 @@
return [NSURLRequest requestWithURL:self.delayURL];
}
- (IMP)_implementationForTask:(NSURLSessionTask *)task selector:(SEL)selector {
- (IMP)_implementationForTask:(NSURLSessionTask *)task selector:(SEL)selector {
return [self _implementationForClass:[task class] selector:selector];
}

View File

@ -0,0 +1,101 @@
// AFXMLDocumentResponseSerializerTests.m
// Copyright (c) 20112016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AFTestCase.h"
#import "AFURLRequestSerialization.h"
#import "AFURLResponseSerialization.h"
#import <XCTest/XCTest.h>
static NSData * AFXMLTestData() {
return [@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo attr1=\"1\" attr2=\"2\"><bar>someValue</bar></foo>" dataUsingEncoding:NSUTF8StringEncoding];
}
#pragma mark -
@interface AFXMLDocumentResponseSerializerTests : AFTestCase
@property (nonatomic, strong) AFXMLDocumentResponseSerializer *responseSerializer;
@end
#pragma mark -
@implementation AFXMLDocumentResponseSerializerTests
- (void)setUp {
[super setUp];
self.responseSerializer = [AFXMLDocumentResponseSerializer serializer];
}
- (void)testThatXMLDocumentResponseSerializerAcceptsApplicationXMLMimeType {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/xml"}];
NSError *error = nil;
[self.responseSerializer validateResponse:response data:AFXMLTestData() error:&error];
XCTAssertNil(error, @"Error handling application/xml");
}
- (void)testThatXMLDocumentResponseSerializerAcceptsTextXMLMimeType {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/xml"}];
NSError *error = nil;
[self.responseSerializer validateResponse:response data:AFXMLTestData() error:&error];
XCTAssertNil(error, @"Error handling text/xml");
}
- (void)testThatXMLDocumentResponseSerializerDoesNotAcceptsNonStandardXMLMimeType {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"nonstandard/xml"}];
NSError *error = nil;
[self.responseSerializer validateResponse:response data:AFXMLTestData() error:&error];
XCTAssertNotNil(error, @"Error should have been thrown for nonstandard/xml");
}
- (void)testThatXMLDocumentResponseSerializerReturnsNSXMLDocumentObjectForValidXML {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/xml"}];
NSError *error = nil;
id responseObject = [self.responseSerializer responseObjectForResponse:response data:AFXMLTestData() error:&error];
XCTAssertNil(error, @"Serialization error should be nil");
XCTAssert([responseObject isKindOfClass:[NSXMLDocument class]], @"Expected response to be a NSXMLDocument");
}
- (void)testThatXMLDocumentResponseSerializerReturnsErrorForInvalidXML {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/xml"}];
NSError *error = nil;
[self.responseSerializer responseObjectForResponse:response data:[@"<foo" dataUsingEncoding:NSUTF8StringEncoding] error:&error];
XCTAssertNotNil(error, @"Serialization error should not be nil");
}
- (void)testThatXMLDocumentResponseSerializerCanBeCopied {
[self.responseSerializer setAcceptableStatusCodes:[NSIndexSet indexSetWithIndex:100]];
[self.responseSerializer setAcceptableContentTypes:[NSSet setWithObject:@"test/type"]];
[self.responseSerializer setOptions:1];
AFXMLDocumentResponseSerializer *copiedSerializer = [self.responseSerializer copy];
XCTAssertNotEqual(copiedSerializer, self.responseSerializer);
XCTAssertEqual(copiedSerializer.acceptableStatusCodes, self.responseSerializer.acceptableStatusCodes);
XCTAssertEqual(copiedSerializer.acceptableContentTypes, self.responseSerializer.acceptableContentTypes);
XCTAssertEqual(copiedSerializer.options, self.responseSerializer.options);
}
@end

View File

@ -0,0 +1,89 @@
// AFXMLParserResponseSerializerTests.m
// Copyright (c) 20112016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AFTestCase.h"
#import "AFURLRequestSerialization.h"
#import "AFURLResponseSerialization.h"
static NSData * AFXMLTestData() {
return [@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo attr1=\"1\" attr2=\"2\"><bar>someValue</bar></foo>" dataUsingEncoding:NSUTF8StringEncoding];
}
#pragma mark -
@interface AFXMLParserResponseSerializerTests : AFTestCase
@property (nonatomic, strong) AFXMLParserResponseSerializer *responseSerializer;
@end
#pragma mark -
@implementation AFXMLParserResponseSerializerTests
- (void)setUp {
[super setUp];
self.responseSerializer = [AFXMLParserResponseSerializer serializer];
}
- (void)testThatXMLParserResponseSerializerAcceptsApplicationXMLMimeType {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/xml"}];
NSError *error = nil;
[self.responseSerializer validateResponse:response data:AFXMLTestData() error:&error];
XCTAssertNil(error, @"Error handling application/xml");
}
- (void)testThatXMLParserResponseSerializerAcceptsTextXMLMimeType {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/xml"}];
NSError *error = nil;
[self.responseSerializer validateResponse:response data:AFXMLTestData() error:&error];
XCTAssertNil(error, @"Error handling text/xml");
}
- (void)testThatXMLParserResponseSerializerDoesNotAcceptsNonStandardXMLMimeType {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"nonstandard/xml"}];
NSError *error = nil;
[self.responseSerializer validateResponse:response data:AFXMLTestData() error:&error];
XCTAssertNotNil(error, @"Error should have been thrown for nonstandard/xml");
}
- (void)testThatXMLParserResponseSerializerReturnsNSXMLParserObjectForValidXML {
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/xml"}];
NSError *error = nil;
id responseObject = [self.responseSerializer responseObjectForResponse:response data:AFXMLTestData() error:&error];
XCTAssertNil(error, @"Serialization error should be nil");
XCTAssert([responseObject isKindOfClass:[NSXMLParser class]], @"Expected response to be a NSXMLParser");
}
- (void)testThatXMLParserResponseSerializerCanBeCopied {
[self.responseSerializer setAcceptableStatusCodes:[NSIndexSet indexSetWithIndex:100]];
[self.responseSerializer setAcceptableContentTypes:[NSSet setWithObject:@"test/type"]];
AFXMLParserResponseSerializer *copiedSerializer = [self.responseSerializer copy];
XCTAssertNotEqual(copiedSerializer, self.responseSerializer);
XCTAssertEqual(copiedSerializer.acceptableStatusCodes, self.responseSerializer.acceptableStatusCodes);
XCTAssertEqual(copiedSerializer.acceptableContentTypes, self.responseSerializer.acceptableContentTypes);
}
@end

View File

@ -72,6 +72,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
@protocol AFImageRequestCache <AFImageCache>
/**
Asks if the image should be cached using an identifier created from the request and additional identifier.
@param image The image to be cached.
@param request The unique URL request identifing the image asset.
@param identifier The additional identifier to apply to the URL request to identify the image.
@return A BOOL indicating whether or not the image should be added to the cache. YES will cache, NO will prevent caching.
*/
- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier;
/**
Adds the image to the cache using an identifier created from the request and additional identifier.

View File

@ -28,7 +28,7 @@
@interface AFCachedImage : NSObject
@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) NSString *identifier;
@property (nonatomic, copy) NSString *identifier;
@property (nonatomic, assign) UInt64 totalBytes;
@property (nonatomic, strong) NSDate *lastAccessDate;
@property (nonatomic, assign) UInt64 currentMemoryUsage;
@ -37,7 +37,7 @@
@implementation AFCachedImage
-(instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier {
- (instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier {
if (self = [self init]) {
self.image = image;
self.identifier = identifier;
@ -51,7 +51,7 @@
return self;
}
- (UIImage*)accessImage {
- (UIImage *)accessImage {
self.lastAccessDate = [NSDate date];
return self.image;
}
@ -134,7 +134,7 @@
[self.cachedImages removeObjectForKey:cachedImage.identifier];
bytesPurged += cachedImage.totalBytes;
if (bytesPurged >= bytesToPurge) {
break ;
break;
}
}
self.currentMemoryUsage -= bytesPurged;
@ -196,6 +196,10 @@
return key;
}
- (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier {
return YES;
}
@end
#endif

View File

@ -81,6 +81,11 @@ typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
*/
+ (NSURLCache *)defaultURLCache;
/**
The default `NSURLSessionConfiguration` with common usage parameter values.
*/
+ (NSURLSessionConfiguration *)defaultURLSessionConfiguration;
/**
Default initializer
@ -88,6 +93,15 @@ typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) {
*/
- (instancetype)init;
/**
Initializer with specific `URLSessionConfiguration`
@param configuration The `NSURLSessionConfiguration` to be be used
@return An instance of `AFImageDownloader` initialized with default values and custom `NSURLSessionConfiguration`
*/
- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration;
/**
Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache.

View File

@ -28,8 +28,8 @@
@interface AFImageDownloaderResponseHandler : NSObject
@property (nonatomic, strong) NSUUID *uuid;
@property (nonatomic, copy) void (^successBlock)(NSURLRequest*, NSHTTPURLResponse*, UIImage*);
@property (nonatomic, copy) void (^failureBlock)(NSURLRequest*, NSHTTPURLResponse*, NSError*);
@property (nonatomic, copy) void (^successBlock)(NSURLRequest *, NSHTTPURLResponse *, UIImage *);
@property (nonatomic, copy) void (^failureBlock)(NSURLRequest *, NSHTTPURLResponse *, NSError *);
@end
@implementation AFImageDownloaderResponseHandler
@ -71,11 +71,11 @@
return self;
}
- (void)addResponseHandler:(AFImageDownloaderResponseHandler*)handler {
- (void)addResponseHandler:(AFImageDownloaderResponseHandler *)handler {
[self.responseHandlers addObject:handler];
}
- (void)removeResponseHandler:(AFImageDownloaderResponseHandler*)handler {
- (void)removeResponseHandler:(AFImageDownloaderResponseHandler *)handler {
[self.responseHandlers removeObject:handler];
}
@ -106,10 +106,20 @@
@end
@implementation AFImageDownloader
+ (NSURLCache *)defaultURLCache {
// It's been discovered that a crash will occur on certain versions
// of iOS if you customize the cache.
//
// More info can be found here: https://devforums.apple.com/message/1102182#1102182
//
// When iOS 7 support is dropped, this should be modified to use
// NSProcessInfo methods instead.
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.2" options:NSNumericSearch] == NSOrderedAscending) {
return [NSURLCache sharedURLCache];
}
return [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024
diskCapacity:150 * 1024 * 1024
diskPath:@"com.alamofire.imagedownloader"];
@ -133,7 +143,11 @@
- (instancetype)init {
NSURLSessionConfiguration *defaultConfiguration = [self.class defaultURLSessionConfiguration];
AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:defaultConfiguration];
return [self initWithSessionConfiguration:defaultConfiguration];
}
- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration {
AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
sessionManager.responseSerializer = [AFImageResponseSerializer serializer];
return [self initWithSessionManager:sessionManager
@ -240,24 +254,26 @@
completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
dispatch_async(self.responseQueue, ^{
__strong __typeof__(weakSelf) strongSelf = weakSelf;
AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier];
AFImageDownloaderMergedTask *mergedTask = [strongSelf safelyGetMergedTask:URLIdentifier];
if ([mergedTask.identifier isEqual:mergedTaskIdentifier]) {
mergedTask = [strongSelf safelyRemoveMergedTaskWithURLIdentifier:URLIdentifier];
if (error) {
for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
if (handler.failureBlock) {
dispatch_async(dispatch_get_main_queue(), ^{
handler.failureBlock(request, (NSHTTPURLResponse*)response, error);
handler.failureBlock(request, (NSHTTPURLResponse *)response, error);
});
}
}
} else {
[strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];
if ([strongSelf.imageCache shouldCacheImage:responseObject forRequest:request withAdditionalIdentifier:nil]) {
[strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil];
}
for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) {
if (handler.successBlock) {
dispatch_async(dispatch_get_main_queue(), ^{
handler.successBlock(request, (NSHTTPURLResponse*)response, responseObject);
handler.successBlock(request, (NSHTTPURLResponse *)response, responseObject);
});
}
}
@ -324,7 +340,7 @@
});
}
- (AFImageDownloaderMergedTask*)safelyRemoveMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {
- (AFImageDownloaderMergedTask *)safelyRemoveMergedTaskWithURLIdentifier:(NSString *)URLIdentifier {
__block AFImageDownloaderMergedTask *mergedTask = nil;
dispatch_sync(self.synchronizationQueue, ^{
mergedTask = [self removeMergedTaskWithURLIdentifier:URLIdentifier];
@ -388,6 +404,14 @@
return self.activeRequestCount < self.maximumActiveDownloads;
}
- (AFImageDownloaderMergedTask *)safelyGetMergedTask:(NSString *)URLIdentifier {
__block AFImageDownloaderMergedTask *mergedTask;
dispatch_sync(self.synchronizationQueue, ^(){
mergedTask = self.mergedTasks[URLIdentifier];
});
return mergedTask;
}
@end
#endif

View File

@ -103,11 +103,11 @@ static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState
+ (AFImageDownloader *)sharedImageDownloader {
return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
return objc_getAssociatedObject([UIButton class], @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
}
+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject([UIButton class], @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
#pragma mark -
@ -168,7 +168,7 @@ static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState
if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
if (success) {
success(request, response, responseObject);
} else if(responseObject) {
} else if (responseObject) {
[strongSelf setImage:responseObject forState:state];
}
[strongSelf af_setImageDownloadReceipt:nil forState:state];
@ -247,7 +247,7 @@ static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState
if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) {
if (success) {
success(request, response, responseObject);
} else if(responseObject) {
} else if (responseObject) {
[strongSelf setBackgroundImage:responseObject forState:state];
}
[strongSelf af_setBackgroundImageDownloadReceipt:nil forState:state];

View File

@ -28,7 +28,7 @@
@interface UIImage (AFNetworking)
+ (UIImage*) safeImageWithData:(NSData*)data;
+ (UIImage *)safeImageWithData:(NSData *)data;
@end

View File

@ -48,11 +48,11 @@
@implementation UIImageView (AFNetworking)
+ (AFImageDownloader *)sharedImageDownloader {
return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
return objc_getAssociatedObject([UIImageView class], @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance];
}
+ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader {
objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject([UIImageView class], @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
#pragma mark -
@ -75,17 +75,19 @@
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure
{
if ([urlRequest URL] == nil) {
[self cancelImageDownloadTask];
self.image = placeholderImage;
if (failure) {
NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:nil];
failure(urlRequest, nil, error);
}
return;
}
if ([self isActiveTaskURLEqualToURLRequest:urlRequest]){
if ([self isActiveTaskURLEqualToURLRequest:urlRequest]) {
return;
}
[self cancelImageDownloadTask];
AFImageDownloader *downloader = [[self class] sharedImageDownloader];
@ -116,7 +118,7 @@
if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) {
if (success) {
success(request, response, responseObject);
} else if(responseObject) {
} else if (responseObject) {
strongSelf.image = responseObject;
}
[strongSelf clearActiveDownloadInformation];

View File

@ -49,7 +49,7 @@
@implementation UIWebView (AFNetworking)
- (AFHTTPSessionManager *)sessionManager {
- (AFHTTPSessionManager *)sessionManager {
static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
@ -119,27 +119,28 @@
self.af_URLSessionTask = nil;
__weak __typeof(self)weakSelf = self;
NSURLSessionDataTask *dataTask;
__block NSURLSessionDataTask *dataTask;
dataTask = [self.sessionManager
GET:request.URL.absoluteString
parameters:nil
progress:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (success) {
success((NSHTTPURLResponse *)task.response, responseObject);
}
[strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[task.currentRequest URL]];
dataTaskWithRequest:request
uploadProgress:nil
downloadProgress:nil
completionHandler:^(NSURLResponse * _Nonnull response, id _Nonnull responseObject, NSError * _Nullable error) {
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (error) {
if (failure) {
failure(error);
}
} else {
if (success) {
success((NSHTTPURLResponse *)response, responseObject);
}
[strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[dataTask.currentRequest URL]];
if ([strongSelf.delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
[strongSelf.delegate webViewDidFinishLoad:strongSelf];
}
}
failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
if (failure) {
failure(error);
}
}];
if ([strongSelf.delegate respondsToSelector:@selector(webViewDidFinishLoad:)]) {
[strongSelf.delegate webViewDidFinishLoad:strongSelf];
}
}
}];
self.af_URLSessionTask = dataTask;
if (progress != nil) {
*progress = [self.sessionManager downloadProgressForTask:dataTask];

View File

@ -2,10 +2,10 @@ AF_WORKSPACE="AFNetworking.xcworkspace"
AF_IOS_FRAMEWORK_SCHEME="AFNetworking iOS"
AF_TVOS_FRAMEWORK_SCHEME="AFNetworking tvOS"
AF_OSX_FRAMEWORK_SCHEME="AFNetworking OS X"
AF_OSX_FRAMEWORK_SCHEME="AFNetworking macOS"
AF_IOS_EXAMPLE_SCHEME="iOS Example"
AF_TVOS_EXAMPLE_SCHEME="tvOS Example"
AF_OSX_EXAMPLE_SCHEME="OS X Example"
AF_OSX_EXAMPLE_SCHEME="macOS Example"
FASTLANE_EXPLICIT_OPEN_SIMULATOR=1

View File

@ -1,15 +1,14 @@
AF_IOS_SDK=iphonesimulator10.0
AF_MAC_SDK=macosx10.11
AF_TVOS_SDK=appletvsimulator10.0
AF_IOS_SDK=iphonesimulator13.0
AF_MAC_SDK=macosx10.15
AF_TVOS_SDK=appletvsimulator13.0
AF_CONFIGURATION=Release
SCAN_WORKSPACE=$AF_WORKSPACE
SCAN_SCHEME=$AF_IOS_FRAMEWORK_SCHEME
SCAN_DEVICE="iPhone 7"
SCAN_SDK=$AF_IOS_SDK
SCAN_OUTPUT_DIRECTORY=fastlane/test-output
EXAMPLE_WORKSPACE=$AF_WORKSPACE
EXAMPLE_SCHEME=$AF_IOS_EXAMPLE_SCHEME
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 7"
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 8"

View File

@ -1,3 +0,0 @@
SCAN_DEVICE="iPhone 7"
SCAN_SDK=$AF_IOS_SDK
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 7"

View File

@ -0,0 +1,3 @@
SCAN_DEVICE="iPhone 8"
SCAN_SDK=iphonesimulator11.0
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 8"

View File

@ -0,0 +1,3 @@
SCAN_DEVICE="iPhone 8"
SCAN_SDK=iphonesimulator11.1
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 8"

View File

@ -0,0 +1,3 @@
SCAN_DEVICE="iPhone 8"
SCAN_SDK=iphonesimulator11.2
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 8"

View File

@ -0,0 +1,3 @@
SCAN_DEVICE="iPhone 8"
SCAN_SDK=iphonesimulator11.3
EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 8"

Some files were not shown because too many files have changed in this diff Show More