Compare commits

...

83 Commits
master ... 2.x

Author SHA1 Message Date
Jeff Kelley
4f592b6aea Update CHANGELOG.md 2019-02-12 23:47:01 -05:00
Jeff Kelley
1758ced096 Bump version to 2.7. 2019-02-12 23:38:48 -05:00
Jeff Kelley
4f73d03777 Merge branch 'pr/4296' into 2.x 2019-02-12 23:28:15 -05:00
Jeff Kelley
877dabd166
Merge pull request #4335 from sashaweiss/addNullabilitySpecifiers
Add nullability specifiers to all 'id responseObject' parameters
2019-02-12 14:28:56 -05:00
sashaweiss
7fd1ae9775 Merge branch 'og/2.x' into addNullabilitySpecifiers 2019-02-12 10:33:54 -08:00
Jeff Kelley
0375f0fff4
Merge pull request #4329 from AFNetworking/update-2.x-travis-settings
[2.x] Update Podfile to work on modern CocoaPods.
2019-02-11 21:48:36 -05:00
Jeff Kelley
e9f73a012b Stop monitoring before destroying reachability object. 2019-02-11 21:16:21 -05:00
Jeff Kelley
fe467f3f52 Don’t use ARC for reachability ref. 2019-02-11 21:16:21 -05:00
Jeff Kelley
1e295ee421 Tweak tests to send expressions directly. 2019-02-11 21:15:29 -05:00
Jeff Kelley
9f5dad3c46 Add tests and also prohibit +new from working. 2019-02-11 21:15:28 -05:00
Cédric Luthi
bd15694210 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.
2019-02-11 21:14:54 -05:00
Cédric Luthi
498d58d5cb Explicitly set the expectation to nil to avoid calling fulfill twice 2019-02-11 21:14:34 -05:00
Cédric Luthi
cf6566552a Enable domain reachability tests 2019-02-11 21:13:53 -05:00
Cédric Luthi
37d7143fa8 Fulfill the expectation once the network status becomes reachable
Do not use XCTAssertEqual(reachable, ...) because it might transition to AFNetworkReachabilityStatusNotReachable before becoming reachable.
2019-02-11 21:13:22 -05:00
Cédric Luthi
83b3363681 Remove unnecessary assert
This pattern does not make sense at all because the assert can never fail.

if (condition) {
    XCTAssert(condition, @"comment");
}
2019-02-11 21:12:13 -05:00
Jeff Kelley
cc634c2ac2 Update certificates in tests. 2019-02-09 11:44:48 -05:00
Jeff Kelley
389be93005 Track Podfile.lock 2019-02-09 11:31:07 -05:00
sashaweiss
2cc79f0860 Add nullability specifiers to all 'id responseObject' parameters 2018-12-17 10:20:31 -08:00
Jeff Kelley
22d9a594bf Fix tests with new certificates. 2018-12-07 11:08:33 -05:00
Jeff Kelley
374931cd8f Update to a supported Xcode image on Travis. 2018-12-07 10:53:24 -05:00
Jeff Kelley
d2a462f288 Update Podfile to work on modern CocoaPods. 2018-12-07 10:47:55 -05:00
Jorge Cravioto
34b0ffb811
Adding nullable attribute to responseObject for post method
If you are consuming the AFHTTPSessionManager from swift on xcode 9.3 or above, this will crash when the response has no content (204). This is because of strict closure signature in swift.
2018-10-03 06:05:22 -07:00
Jorge Cravioto
63aa18c972
Adding nullable attribute to responseObject for post method
If you are consuming the AFHTTPSessionManager from swift on xcode 9.3 or above, this will crash when the response has no content (204). This is because of strict closure signature in swift.
2018-10-03 06:03:58 -07:00
Kevin Harwood
806d870207 Merge pull request #3204 from kyle-fox/readme-fix
Remove testing from command line in readme
2015-12-08 14:16:36 -06:00
Kyle Fox
4151dd1a68 Remove testing from command line in readme
Looks like this functionality was removed when the Rakefile was deleted in e0815da
2015-12-08 12:30:56 -05:00
Kevin Harwood
0820d39cf6 Updated readme and changelog 2015-12-03 10:28:02 -06:00
Kevin Harwood
ee89cc988e Preparing for the 2.6.3 release 2015-11-11 08:37:27 -06:00
Kevin Harwood
3cfa2127e0 Merge pull request #3142 from AFNetworking/fix/3138
Fixed clang analyzer warning suppression that prevented building under some project configurations
2015-11-11 08:25:30 -06:00
Kevin Harwood
085a4dcfa4 Fixed issue clang analyzer warning suppression that preventing building under some project configurations
Fix for #3138
2015-11-09 10:27:44 -06:00
Kevin Harwood
313c9797e3 Merge pull request #3139 from jcayzac/fix-3137
Restored Xcode 6 compatibility
2015-11-09 10:18:43 -06:00
Kevin Harwood
a55cfc0982 Updated changelog for #31377 2015-11-09 09:00:12 -06:00
Julien Cayzac
51e86a901c Xcode 6 compatibility (#3137) 2015-11-09 12:36:51 +09:00
Kevin Harwood
928858869d Prepping for the 2.6.2 release 2015-11-06 13:53:20 -06:00
Kevin Harwood
743953662a Merge pull request #3133 from AFNetworking/fix/3104
Fixed swift interop issue that prevented returning a nil NSURL for a download task
2015-11-06 10:26:34 -06:00
Kevin Harwood
d7f4b937e5 Merge pull request #3132 from AFNetworking/ci/xcode_71
Updated travis to run on 7.1
2015-11-06 10:26:15 -06:00
Kevin Harwood
4e592847ae Merge pull request #3117 from MichaelHackett/serialize-reachability-callbacks
Fixed race condition in reachability callback delivery
2015-11-06 09:52:37 -06:00
Kevin Harwood
5be7853b1f Merge pull request #3131 from AFNetworking/fix/3110
Suppressed false positive memory leak warning in Reachability Manager
2015-11-06 09:28:44 -06:00
Kevin Harwood
9f2c8b8783 Merge pull request #3130 from AFNetworking/fix/2810
Fixed swift interop issue with throws and Request/Response serialization
2015-11-06 09:28:18 -06:00
Kevin Harwood
105fc642f9 Fixed swift interop issue that prevented returning a nil NSURL for a download task
Fix for #3104 and #3043
2015-11-06 09:25:34 -06:00
Kevin Harwood
d6929054c7 Updated travis to run on 7.1 2015-11-06 09:16:47 -06:00
Kevin Harwood
8acca137a4 Suppressed false positive memory leak warning in Reachability Manager
Fix for #3110
2015-11-06 09:03:06 -06:00
Kevin Harwood
aa81eb47d4 Fixed swift interop issue with throws and Request/Response serialization
Fix for #2810
2015-11-06 08:38:29 -06:00
Michael Hackett
07c18ad0ff Remove reachability-association type -- no longer need special case.
It appears that a check was put in place to work around a race condition
when reachability was associated with a domain name. However, the cause
of the race condition is addressed in the previous commit, so the
special-casing is no longer needed.
2015-11-04 14:59:58 -04:00
Michael Hackett
9f44d51da7 Make all reachability-status callbacks from the main GCD queue.
Because the run-loop reachability callback executed its callback
directly, whereas the initial check (fired off from
`-[AFNetworkReachabilityManager startMonitoring]`) executed the callback
from a GCD queue, it was possible for the callbacks to be executed out
of order from when the status was obtained, leaving the listener in the
incorrect state.

By sending both routes through the same GCD-queuing function, both the
callbacks and NSNotifications will be processed in the order in which
they are sent. It also removes some repetition in the code.
2015-11-04 14:58:51 -04:00
Kevin Harwood
406057afbc Merge pull request #3112 from dkhamsing/patch-1
Fix URL in README
2015-11-03 11:09:54 -06:00
dkhamsing
128954682b Fix URL in README 2015-11-03 09:04:03 -08:00
Kevin Harwood
6525a55c0a Merge pull request #3109 from frankenbot/master
FIXED URLs that were redirecting in the README
2015-11-03 08:49:22 -06:00
frankenbot
64974e28cc Update redirects 2015-11-02 22:53:41 -08:00
Kevin Harwood
5dab172c47 Merge pull request #3102 from AFNetworking/3019
Removed Project Warnings (and updated version of #3019)
2015-10-27 14:35:18 -05:00
Kevin Harwood
1838e68638 Suppressed warnings for test file 2015-10-27 14:16:51 -05:00
Kevin Harwood
cc9d7ba0eb Updating Test Target for new version of Cocoapods 2015-10-27 14:10:40 -05:00
Kevin Harwood
97519e4e6b Updated project settings for Xcode 7.1 2015-10-27 14:09:57 -05:00
Kevin Harwood
477bdee800 Removed additional warnings 2015-10-27 14:06:37 -05:00
Steve Christensen
bb3773e20c Added some casts to fix compiler errors with stricy build settings. Renamed some function parameters to avoid reserved keyword issues if the compiler is set for Obj-C++. 2015-10-27 14:03:08 -05:00
Kevin Harwood
1d5c63ec48 Merge pull request #3099 from wrtsprt/master
Fix README link to WWDC session
2015-10-27 10:51:12 -05:00
Raphael Doehring
6f20bf25b1 Fix README link to WWDC session …
Apple changed the format WWDC video URLs.
2015-10-26 17:21:28 +01:00
Kevin Harwood
09f6cc19e1 Additional updates for #2794 2015-10-21 13:55:07 -05:00
Oleg Naumenko
22baaac0e0 fix memory leak 2015-10-21 13:48:15 -05:00
Oleg Naumenko
b43776acfe fix memory leak in NSURLSession 2015-10-21 13:47:02 -05:00
Kevin Harwood
c90c3dae68 Added test for #3057 2015-10-21 09:25:05 -05:00
Takeru Chuganji
3e12404b2d fix nullablity 2015-10-21 08:51:42 -05:00
Takeru Chuganji
76bc4cb3f4 add missing __nullable attributes 2015-10-21 08:51:42 -05:00
Kevin Harwood
d89c4fefe7 Cherry-picked change from #3063 2015-10-21 08:48:21 -05:00
Kevin Harwood
c94299a372 Merge pull request #2887 from AFNetworking/security/2887
AFHTTPSessionManager copying securityPolicy not getting copied
2015-10-21 08:15:27 -05:00
Kevin Harwood
4f39335725 Changed id to instancetype 2015-10-20 09:25:52 -05:00
Kevin Harwood
807f1b9c75 AFSecurityPolicy now conforms to NSSecureCoding and NSCopying for #2887 2015-10-19 15:51:29 -05:00
Kevin Harwood
acfaa7ea80 Merge pull request #3065 from AFNetworking/kylef/os_obj_use_objc
Switch to OS_OBJECT_USE_OBJC
2015-10-16 08:53:09 -05:00
Kyle Fuller
02b80938ee Switch to OS_OBJECT_USE_OBJC 2015-10-15 20:47:19 -07:00
Kevin Harwood
dad1b8bfcc updated docs for 2.6.1 2015-10-13 14:00:01 -05:00
Kevin Harwood
50f01e2f05 Merge pull request #2496 from AFNetworking/2496
hasSpaceAvailable become "false" and no failure blocks are called
2015-10-13 13:57:09 -05:00
Kevin Harwood
6b6d41d992 - Updated implementation for #3028
- Added test demonstrating fix
2015-10-13 13:29:42 -05:00
AM
a7820d2e0a crash fix with iOS 7 stringByAddingPercentEncodingWithAllowedCharacters
method
2015-10-13 13:04:36 -05:00
Kevin Harwood
4696469eaa Bringing in fix for #2496 2015-10-13 12:57:33 -05:00
Kevin Harwood
6d18d1a791 Merge pull request #2743 from AFNetworking/2743
AWS analytics for iOS app crash in AFNetworking
2015-10-13 12:50:03 -05:00
Kevin Harwood
588f2f19f2 Potential fix for #2743 2015-10-13 11:29:04 -05:00
Kevin Harwood
abd9c02e9f Migrated to FOUNDATION_EXPORT in all header files 2015-10-13 11:25:56 -05:00
Andrey Mikhaylov
2ab3bbdcc8 Fix linker issues when C++ imports AFNetworkReachabilityManager.h (Fixes #3040)
Replace `extern` with `FOUNDATION_EXPORT` which works correctly when C++ imports the header.
2015-10-13 11:25:56 -05:00
Kevin Harwood
1ba256a6d6 Merge pull request #3032 from AFNetworking/2.x_travis_refactor
Migrated to Travis Matrix for 2.X
2015-10-13 11:24:06 -05:00
Kevin Harwood
e0815dacfa Migrated to Travis Matrix 2015-10-13 10:43:52 -05:00
Kevin Harwood
824f7c570a Merge pull request #2868 from jcayzac/fix-2864
Fix #2864: allow empty x-www-form-urlencoded bodies
2015-10-08 14:40:41 -05:00
Julien Cayzac
9cb72ef844 Added unit tests for #2864 2015-08-27 12:33:34 +09:00
Julien Cayzac
76fa71824d Added unit tests for #2864 2015-08-04 14:46:27 +09:00
Julien Cayzac
680a478b36 Fix #2864: allow empty x-www-form-urlencoded bodies 2015-07-30 14:17:44 +09:00
56 changed files with 1279 additions and 446 deletions

2
.gitignore vendored
View File

@ -17,5 +17,3 @@ profile
DerivedData
.idea/
Tests/Pods
Tests/Podfile.lock
Tests/AFNetworking Tests.xcodeproj/xcshareddata/xcschemes/

View File

@ -1,8 +1,37 @@
language: objective-c
osx_image: xcode7
osx_image: xcode7.3
sudo: false
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
matrix:
- DESTINATION="OS=9.1,name=iPhone 6s" TEST_SCHEME="iOS Tests" EXAMPLE_SCHEME="AFNetworking iOS Example" SDK=iphonesimulator9.3 RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=9.0,name=iPhone 6 Plus" TEST_SCHEME="iOS Tests" EXAMPLE_SCHEME="AFNetworking iOS Example" SDK=iphonesimulator9.3 RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=8.4,name=iPhone 6" TEST_SCHEME="iOS Tests" EXAMPLE_SCHEME="AFNetworking iOS Example" SDK=iphonesimulator9.3 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.3,name=iPhone 5S" TEST_SCHEME="iOS Tests" EXAMPLE_SCHEME="AFNetworking iOS Example" SDK=iphonesimulator9.3 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.2,name=iPhone 5" TEST_SCHEME="iOS Tests" EXAMPLE_SCHEME="AFNetworking iOS Example" SDK=iphonesimulator9.3 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.1,name=iPhone 4S" TEST_SCHEME="iOS Tests" EXAMPLE_SCHEME="AFNetworking iOS Example" SDK=iphonesimulator9.3 RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="YES"
# TESTS ARE CURRENTLY DISABLED FOR MAC OS X DUE TO THIS ISSUE: https://github.com/travis-ci/travis-ci/issues/4904
- DESTINATION="arch=x86_64" TEST_SCHEME="OS X Tests" SDK=macosx10.11 EXAMPLE_SCHEME="AFNetworking Example" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO"
before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- cd Tests && pod install && cd $TRAVIS_BUILD_DIR
script: rake test
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- cd Tests && pod install && cd $TRAVIS_BUILD_DIR
script:
- set -o pipefail
- xcodebuild -version
- xcodebuild -showsdks
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -workspace AFNetworking.xcworkspace -scheme "$TEST_SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c;
xcodebuild -workspace AFNetworking.xcworkspace -scheme "$TEST_SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO test | xcpretty -c;
fi
- if [ $BUILD_EXAMPLE == "YES" ]; then
xcodebuild -workspace AFNetworking.xcworkspace -scheme "$EXAMPLE_SCHEME" -destination "$DESTINATION"
-configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
xcodebuild -workspace AFNetworking.xcworkspace -scheme "$EXAMPLE_SCHEME" -destination "$DESTINATION"
-configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
fi
- if [ $POD_LINT == "YES" ]; then
pod lib lint --quick;
fi

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AFNetworking'
s.version = '2.6.0'
s.version = '2.7.0'
s.license = 'MIT'
s.summary = 'A delightful iOS and OS X networking framework.'
s.homepage = 'https://github.com/AFNetworking/AFNetworking'

View File

@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN
@param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request.
@param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request.
*/
- (void)setCompletionBlockWithSuccess:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
- (void)setCompletionBlockWithSuccess:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
@end

View File

@ -50,7 +50,7 @@ static dispatch_group_t http_request_operation_completion_group() {
@interface AFHTTPRequestOperation ()
@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response;
@property (readwrite, nonatomic, strong) id responseObject;
@property (readwrite, nonatomic, strong, nullable) id responseObject;
@property (readwrite, nonatomic, strong) NSError *responseSerializationError;
@property (readwrite, nonatomic, strong) NSRecursiveLock *lock;
@end
@ -104,7 +104,7 @@ static dispatch_group_t http_request_operation_completion_group() {
#pragma mark - AFHTTPRequestOperation
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
// completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle.

View File

@ -160,7 +160,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The dispatch queue for the `completionBlock` of request operations. If `NULL` (default), the main queue is used.
*/
#if OS_OBJECT_HAVE_OBJC_SUPPORT
#if OS_OBJECT_USE_OBJC
@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;
#else
@property (nonatomic, assign, nullable) dispatch_queue_t completionQueue;
@ -169,7 +169,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The dispatch group for the `completionBlock` of request operations. If `NULL` (default), a private dispatch group is used.
*/
#if OS_OBJECT_HAVE_OBJC_SUPPORT
#if OS_OBJECT_USE_OBJC
@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;
#else
@property (nonatomic, assign, nullable) dispatch_group_t completionGroup;
@ -207,7 +207,7 @@ NS_ASSUME_NONNULL_BEGIN
@param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred.
*/
- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
///---------------------------
@ -226,8 +226,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable AFHTTPRequestOperation *)GET:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
/**
Creates and runs an `AFHTTPRequestOperation` with a `HEAD` request.
@ -242,7 +242,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable AFHTTPRequestOperation *)HEAD:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(AFHTTPRequestOperation *operation))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
/**
Creates and runs an `AFHTTPRequestOperation` with a `POST` request.
@ -256,8 +256,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
/**
Creates and runs an `AFHTTPRequestOperation` with a multipart `POST` request.
@ -273,8 +273,8 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(nullable id)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
/**
Creates and runs an `AFHTTPRequestOperation` with a `PUT` request.
@ -288,8 +288,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable AFHTTPRequestOperation *)PUT:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
/**
Creates and runs an `AFHTTPRequestOperation` with a `PATCH` request.
@ -303,8 +303,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable AFHTTPRequestOperation *)PATCH:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
/**
Creates and runs an `AFHTTPRequestOperation` with a `DELETE` request.
@ -318,8 +318,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable AFHTTPRequestOperation *)DELETE:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation *operation, NSError *error))failure;
success:(nullable void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(nullable void (^)(AFHTTPRequestOperation * __nullable operation, NSError *error))failure;
@end

View File

@ -94,7 +94,7 @@
- (AFHTTPRequestOperation *)HTTPRequestOperationWithHTTPMethod:(NSString *)method
URLString:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
NSError *serializationError = nil;
@ -116,7 +116,7 @@
}
- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
@ -136,7 +136,7 @@
- (AFHTTPRequestOperation *)GET:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"GET" URLString:URLString parameters:parameters success:success failure:failure];
@ -164,7 +164,7 @@
- (AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"POST" URLString:URLString parameters:parameters success:success failure:failure];
@ -177,7 +177,7 @@
- (AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(id)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
NSError *serializationError = nil;
@ -204,7 +204,7 @@
- (AFHTTPRequestOperation *)PUT:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters success:success failure:failure];
@ -216,7 +216,7 @@
- (AFHTTPRequestOperation *)PATCH:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters success:success failure:failure];
@ -228,7 +228,7 @@
- (AFHTTPRequestOperation *)DELETE:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
success:(void (^)(AFHTTPRequestOperation *operation, id __nullable responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters success:success failure:failure];
@ -260,6 +260,10 @@
self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
if (decodedPolicy) {
self.securityPolicy = decodedPolicy;
}
return self;
}
@ -268,6 +272,7 @@
[coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))];
[coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];
[coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];
[coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];
}
#pragma mark - NSCopying
@ -277,6 +282,7 @@
HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];
return HTTPClient;
}

View File

@ -151,8 +151,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
success:(nullable void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;
/**
Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.
@ -167,7 +167,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;
/**
Creates and runs an `NSURLSessionDataTask` with a `POST` request.
@ -181,8 +181,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
success:(nullable void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;
/**
Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.
@ -198,8 +198,8 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(nullable id)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
success:(nullable void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;
/**
Creates and runs an `NSURLSessionDataTask` with a `PUT` request.
@ -213,8 +213,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
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.
@ -228,8 +228,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
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.
@ -243,8 +243,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString
parameters:(nullable id)parameters
success:(nullable void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask *task, NSError *error))failure;
success:(nullable void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(nullable void (^)(NSURLSessionDataTask * __nullable task, NSError *error))failure;
@end

View File

@ -108,7 +108,7 @@
- (NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET" URLString:URLString parameters:parameters success:success failure:failure];
@ -136,7 +136,7 @@
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters success:success failure:failure];
@ -149,7 +149,7 @@
- (NSURLSessionDataTask *)POST:(NSString *)URLString
parameters:(id)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSError *serializationError = nil;
@ -167,7 +167,7 @@
return nil;
}
__block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:nil completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
__block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:nil completionHandler:^(NSURLResponse * __unused response, id __nullable responseObject, NSError *error) {
if (error) {
if (failure) {
failure(task, error);
@ -186,7 +186,7 @@
- (NSURLSessionDataTask *)PUT:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters success:success failure:failure];
@ -198,7 +198,7 @@
- (NSURLSessionDataTask *)PATCH:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters success:success failure:failure];
@ -210,7 +210,7 @@
- (NSURLSessionDataTask *)DELETE:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
success:(void (^)(NSURLSessionDataTask *task, id __nullable responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
{
NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters success:success failure:failure];
@ -242,7 +242,7 @@
}
__block NSURLSessionDataTask *dataTask = nil;
dataTask = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) {
dataTask = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id __nullable responseObject, NSError *error) {
if (error) {
if (failure) {
failure(dataTask, error);
@ -290,6 +290,10 @@
self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
if (decodedPolicy) {
self.securityPolicy = decodedPolicy;
}
return self;
}
@ -305,6 +309,7 @@
}
[coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];
[coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];
[coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];
}
#pragma mark - NSCopying
@ -314,7 +319,7 @@
HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];
return HTTPClient;
}

View File

@ -108,6 +108,16 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;
/**
* Unavailable initializer
*/
+ (instancetype)new NS_UNAVAILABLE;
/**
* Unavailable initializer
*/
- (instancetype)init NS_UNAVAILABLE;
///--------------------------------------------------
/// @name Starting & Stopping Reachability Monitoring
///--------------------------------------------------
@ -191,8 +201,8 @@ NS_ASSUME_NONNULL_BEGIN
@warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
*/
extern NSString * const AFNetworkingReachabilityDidChangeNotification;
extern NSString * const AFNetworkingReachabilityNotificationStatusItem;
FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;
///--------------------
/// @name Functions
@ -201,7 +211,7 @@ extern NSString * const AFNetworkingReachabilityNotificationStatusItem;
/**
Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
*/
extern NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);
NS_ASSUME_NONNULL_END
#endif

View File

@ -33,12 +33,6 @@ NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworking
typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status);
typedef NS_ENUM(NSUInteger, AFNetworkReachabilityAssociation) {
AFNetworkReachabilityForAddress = 1,
AFNetworkReachabilityForAddressPair = 2,
AFNetworkReachabilityForName = 3,
};
NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) {
switch (status) {
case AFNetworkReachabilityStatusNotReachable:
@ -76,20 +70,28 @@ static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetwork
return status;
}
static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {
/**
* Queue a status change notification for the main thread.
*
* This is done to ensure that the notifications are received in the same order
* as they are sent. If notifications are sent directly, it is possible that
* 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) {
AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags);
AFNetworkReachabilityStatusBlock block = (__bridge AFNetworkReachabilityStatusBlock)info;
if (block) {
block(status);
}
dispatch_async(dispatch_get_main_queue(), ^{
if (block) {
block(status);
}
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) };
[notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo];
});
}
static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) {
AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info);
}
static const void * AFNetworkReachabilityRetainCallback(const void *info) {
@ -103,8 +105,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
}
@interface AFNetworkReachabilityManager ()
@property (readwrite, nonatomic, strong) id networkReachability;
@property (readwrite, nonatomic, assign) AFNetworkReachabilityAssociation networkReachabilityAssociation;
@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability;
@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock;
@end
@ -130,17 +131,18 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]);
AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
manager.networkReachabilityAssociation = AFNetworkReachabilityForName;
CFRelease(reachability);
return manager;
}
+ (instancetype)managerForAddress:(const void *)address {
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address);
AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability];
manager.networkReachabilityAssociation = AFNetworkReachabilityForAddress;
CFRelease(reachability);
return manager;
}
@ -150,7 +152,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
return nil;
}
self.networkReachability = CFBridgingRelease(reachability);
_networkReachability = CFRetain(reachability);
self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown;
return self;
@ -158,11 +160,18 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
- (instancetype)init NS_UNAVAILABLE
{
@throw [NSException exceptionWithName:NSGenericException
reason:@"`-init` unavailable. Use `-initWithReachability:` instead"
userInfo:nil];
return nil;
}
- (void)dealloc {
[self stopMonitoring];
if (_networkReachability != NULL) {
CFRelease(_networkReachability);
}
}
#pragma mark -
@ -199,33 +208,16 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
};
id networkReachability = self.networkReachability;
SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL};
SCNetworkReachabilitySetCallback((__bridge SCNetworkReachabilityRef)networkReachability, AFNetworkReachabilityCallback, &context);
SCNetworkReachabilityScheduleWithRunLoop((__bridge SCNetworkReachabilityRef)networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context);
SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
switch (self.networkReachabilityAssociation) {
case AFNetworkReachabilityForName:
break;
case AFNetworkReachabilityForAddress:
case AFNetworkReachabilityForAddressPair:
default: {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{
SCNetworkReachabilityFlags flags;
SCNetworkReachabilityGetFlags((__bridge SCNetworkReachabilityRef)networkReachability, &flags);
AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags);
dispatch_async(dispatch_get_main_queue(), ^{
callback(status);
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:@{ AFNetworkingReachabilityNotificationStatusItem: @(status) }];
});
});
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) {
AFPostReachabilityStatusChange(flags, callback);
}
break;
}
});
}
- (void)stopMonitoring {
@ -233,7 +225,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {
return;
}
SCNetworkReachabilityUnscheduleFromRunLoop((__bridge SCNetworkReachabilityRef)self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
}
#pragma mark -

View File

@ -36,7 +36,7 @@ typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
NS_ASSUME_NONNULL_BEGIN
@interface AFSecurityPolicy : NSObject
@interface AFSecurityPolicy : NSObject <NSSecureCoding, NSCopying>
/**
The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.

View File

@ -251,11 +251,7 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies);
if (self.SSLPinningMode == AFSSLPinningModeNone) {
if (self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust)){
return YES;
} else {
return NO;
}
return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust);
} else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) {
return NO;
}
@ -308,4 +304,44 @@ static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) {
return [NSSet setWithObject:@"pinnedCertificates"];
}
#pragma mark - NSSecureCoding
+ (BOOL)supportsSecureCoding {
return YES;
}
- (instancetype)initWithCoder:(NSCoder *)decoder {
self = [self init];
if (!self) {
return nil;
}
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))];
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))];
[coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))];
[coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))];
[coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))];
}
#pragma mark - NSCopying
- (instancetype)copyWithZone:(NSZone *)zone {
AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init];
securityPolicy.SSLPinningMode = self.SSLPinningMode;
securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates;
securityPolicy.validatesDomainName = self.validatesDomainName;
securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone];
return securityPolicy;
}
@end

View File

@ -334,11 +334,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
Posted when an operation begins executing.
*/
extern NSString * const AFNetworkingOperationDidStartNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingOperationDidStartNotification;
/**
Posted when an operation finishes.
*/
extern NSString * const AFNetworkingOperationDidFinishNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingOperationDidFinishNotification;
NS_ASSUME_NONNULL_END

View File

@ -669,11 +669,11 @@ didReceiveResponse:(NSURLResponse *)response
}
break;
}
if (self.outputStream.streamError) {
} else {
[self.connection cancel];
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.outputStream.streamError];
if (self.outputStream.streamError) {
[self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.outputStream.streamError];
}
return;
}
}
@ -743,7 +743,7 @@ didReceiveResponse:(NSURLResponse *)response
return nil;
}
self.state = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(state))] integerValue];
self.state = (AFOperationState)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(state))] integerValue];
self.response = [decoder decodeObjectOfClass:[NSHTTPURLResponse class] forKey:NSStringFromSelector(@selector(response))];
self.error = [decoder decodeObjectOfClass:[NSError class] forKey:NSStringFromSelector(@selector(error))];
self.responseData = [decoder decodeObjectOfClass:[NSData class] forKey:NSStringFromSelector(@selector(responseData))];

View File

@ -46,8 +46,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request
withParameters:(nullable id)parameters
error:(NSError * __nullable __autoreleasing *)error;
error:(NSError * __nullable __autoreleasing *)error
#ifdef NS_SWIFT_NOTHROW
NS_SWIFT_NOTHROW
#endif
;
@end
#pragma mark -
@ -438,7 +441,7 @@ forHTTPHeaderField:(NSString *)field;
`AFURLRequestSerializationErrorDomain`
AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
*/
extern NSString * const AFURLRequestSerializationErrorDomain;
FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain;
/**
## User info dictionary keys
@ -452,7 +455,7 @@ extern NSString * const AFURLRequestSerializationErrorDomain;
`AFNetworkingOperationFailingURLRequestErrorKey`
The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`.
*/
extern NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
/**
## Throttling Bandwidth for HTTP Request Input Streams
@ -467,7 +470,7 @@ extern NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
`kAFUploadStream3GSuggestedDelay`
Duration of delay each time a packet is read. Equal to 0.2 seconds.
*/
extern NSUInteger const kAFUploadStream3GSuggestedPacketSize;
extern NSTimeInterval const kAFUploadStream3GSuggestedDelay;
FOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize;
FOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay;
NS_ASSUME_NONNULL_END

View File

@ -80,7 +80,32 @@ static NSString * AFPercentEscapedStringFromString(NSString *string) {
NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy];
[allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]];
return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
// FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028
// return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
static NSUInteger const batchSize = 50;
NSUInteger index = 0;
NSMutableString *escaped = @"".mutableCopy;
while (index < string.length) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu"
NSUInteger length = MIN(string.length - index, batchSize);
#pragma GCC diagnostic pop
NSRange range = NSMakeRange(index, length);
// To avoid breaking up character sequences such as 👴🏻👮🏽
range = [string rangeOfComposedCharacterSequencesForRange:range];
NSString *substring = [string substringWithRange:range];
NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet];
[escaped appendString:encoded];
index += range.length;
}
return escaped;
}
#pragma mark -
@ -120,8 +145,8 @@ static NSString * AFPercentEscapedStringFromString(NSString *string) {
#pragma mark -
extern NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary);
extern NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value);
FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary);
FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value);
static NSString * AFQueryStringFromParameters(NSDictionary *parameters) {
NSMutableArray *mutablePairs = [NSMutableArray array];
@ -499,8 +524,8 @@ forHTTPHeaderField:(NSString *)field
}
}];
NSString *query = nil;
if (parameters) {
NSString *query = nil;
if (self.queryStringSerialization) {
NSError *serializationError;
query = self.queryStringSerialization(request, parameters, &serializationError);
@ -519,15 +544,21 @@ forHTTPHeaderField:(NSString *)field
break;
}
}
}
if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) {
if (query) {
mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]];
} else {
if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
[mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
}
[mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]];
}
} else {
// #2864: an empty string is a valid x-www-form-urlencoded payload
if (!query) {
query = @"";
}
if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) {
[mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
}
[mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]];
}
return mutableRequest;
@ -570,7 +601,7 @@ forHTTPHeaderField:(NSString *)field
}
self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy];
self.queryStringSerializationStyle = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];
self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue];
return self;
}
@ -1371,7 +1402,7 @@ typedef enum {
return nil;
}
self.format = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue];
return self;

View File

@ -42,7 +42,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response
data:(nullable NSData *)data
error:(NSError * __nullable __autoreleasing *)error;
error:(NSError * __nullable __autoreleasing *)error
#ifdef NS_SWIFT_NOTHROW
NS_SWIFT_NOTHROW
#endif
;
@end
@ -286,7 +290,7 @@ NS_ASSUME_NONNULL_BEGIN
`AFURLResponseSerializationErrorDomain`
AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.
*/
extern NSString * const AFURLResponseSerializationErrorDomain;
FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain;
/**
## User info dictionary keys
@ -304,8 +308,8 @@ extern NSString * const AFURLResponseSerializationErrorDomain;
`AFNetworkingOperationFailingURLResponseDataErrorKey`
The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`.
*/
extern NSString * const AFNetworkingOperationFailingURLResponseErrorKey;
FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey;
extern NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey;
FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey;
NS_ASSUME_NONNULL_END

View File

@ -501,7 +501,7 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
return nil;
}
self.format = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue];
self.readOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readOptions))] unsignedIntegerValue];
return self;

View File

@ -165,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.
*/
#if OS_OBJECT_HAVE_OBJC_SUPPORT
#if OS_OBJECT_USE_OBJC
@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;
#else
@property (nonatomic, assign, nullable) dispatch_queue_t completionQueue;
@ -174,7 +174,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.
*/
#if OS_OBJECT_HAVE_OBJC_SUPPORT
#if OS_OBJECT_USE_OBJC
@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;
#else
@property (nonatomic, assign, nullable) dispatch_group_t completionGroup;
@ -428,7 +428,7 @@ NS_ASSUME_NONNULL_BEGIN
@param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error.
*/
- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;
- (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:`.
@ -457,98 +457,98 @@ NS_ASSUME_NONNULL_BEGIN
@deprecated Use `AFNetworkingTaskDidResumeNotification` instead.
*/
extern NSString * const AFNetworkingTaskDidStartNotification DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidStartNotification DEPRECATED_ATTRIBUTE;
/**
Posted when a task resumes.
*/
extern NSString * const AFNetworkingTaskDidResumeNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification;
/**
Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.
@deprecated Use `AFNetworkingTaskDidCompleteNotification` instead.
*/
extern NSString * const AFNetworkingTaskDidFinishNotification DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidFinishNotification DEPRECATED_ATTRIBUTE;
/**
Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.
*/
extern NSString * const AFNetworkingTaskDidCompleteNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification;
/**
Posted when a task suspends its execution.
*/
extern NSString * const AFNetworkingTaskDidSuspendNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification;
/**
Posted when a session is invalidated.
*/
extern NSString * const AFURLSessionDidInvalidateNotification;
FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification;
/**
Posted when a session download task encountered an error when moving the temporary download file to a specified destination.
*/
extern NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification;
FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification;
/**
The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if response data exists for the task.
@deprecated Use `AFNetworkingTaskDidCompleteResponseDataKey` instead.
*/
extern NSString * const AFNetworkingTaskDidFinishResponseDataKey DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidFinishResponseDataKey DEPRECATED_ATTRIBUTE;
/**
The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if response data exists for the task.
*/
extern NSString * const AFNetworkingTaskDidCompleteResponseDataKey;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey;
/**
The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the response was serialized.
@deprecated Use `AFNetworkingTaskDidCompleteSerializedResponseKey` instead.
*/
extern NSString * const AFNetworkingTaskDidFinishSerializedResponseKey DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidFinishSerializedResponseKey DEPRECATED_ATTRIBUTE;
/**
The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the response was serialized.
*/
extern NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey;
/**
The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the task has an associated response serializer.
@deprecated Use `AFNetworkingTaskDidCompleteResponseSerializerKey` instead.
*/
extern NSString * const AFNetworkingTaskDidFinishResponseSerializerKey DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidFinishResponseSerializerKey DEPRECATED_ATTRIBUTE;
/**
The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the task has an associated response serializer.
*/
extern NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey;
/**
The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if an the response data has been stored directly to disk.
@deprecated Use `AFNetworkingTaskDidCompleteAssetPathKey` instead.
*/
extern NSString * const AFNetworkingTaskDidFinishAssetPathKey DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidFinishAssetPathKey DEPRECATED_ATTRIBUTE;
/**
The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if an the response data has been stored directly to disk.
*/
extern NSString * const AFNetworkingTaskDidCompleteAssetPathKey;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey;
/**
Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if an error exists.
@deprecated Use `AFNetworkingTaskDidCompleteErrorKey` instead.
*/
extern NSString * const AFNetworkingTaskDidFinishErrorKey DEPRECATED_ATTRIBUTE;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidFinishErrorKey DEPRECATED_ATTRIBUTE;
/**
Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if an error exists.
*/
extern NSString * const AFNetworkingTaskDidCompleteErrorKey;
FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey;
NS_ASSUME_NONNULL_END

View File

@ -101,7 +101,7 @@ typedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSessio
typedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);
typedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes);
typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error);
typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id __nullable responseObject, NSError *error);
#pragma mark -
@ -272,14 +272,14 @@ expectedTotalBytes:(int64_t)expectedTotalBytes {
* - https://github.com/AFNetworking/AFNetworking/pull/2702
*/
static inline void af_swizzleSelector(Class class, SEL originalSelector, SEL swizzledSelector) {
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
static inline void af_swizzleSelector(Class theClass, SEL originalSelector, SEL swizzledSelector) {
Method originalMethod = class_getInstanceMethod(theClass, originalSelector);
Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector);
method_exchangeImplementations(originalMethod, swizzledMethod);
}
static inline BOOL af_addMethod(Class class, SEL selector, Method method) {
return class_addMethod(class, selector, method_getImplementation(method), method_getTypeEncoding(method));
static inline BOOL af_addMethod(Class theClass, SEL selector, Method method) {
return class_addMethod(theClass, selector, method_getImplementation(method), method_getTypeEncoding(method));
}
static NSString * const AFNSURLSessionTaskDidResumeNotification = @"com.alamofire.networking.nsurlsessiontask.resume";
@ -324,11 +324,13 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
7) If the current class implementation of `resume` is not equal to the super class implementation of `resume` AND the current implementation of `resume` is not equal to the original implementation of `af_resume`, THEN swizzle the methods
8) Set the current class to the super class, and repeat steps 3-8
*/
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
NSURLSession * session = [NSURLSession sessionWithConfiguration:configuration];
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
NSURLSessionDataTask *localDataTask = [[NSURLSession sessionWithConfiguration:nil] dataTaskWithURL:nil];
NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil];
#pragma clang diagnostic pop
IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([_AFURLSessionTaskSwizzling class], @selector(af_resume)));
IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([self class], @selector(af_resume)));
Class currentClass = [localDataTask class];
while (class_getInstanceMethod(currentClass, @selector(resume))) {
@ -343,18 +345,21 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
}
[localDataTask cancel];
[session finishTasksAndInvalidate];
}
}
+ (void)swizzleResumeAndSuspendMethodForClass:(Class)class {
+ (void)swizzleResumeAndSuspendMethodForClass:(Class)theClass {
Method afResumeMethod = class_getInstanceMethod(self, @selector(af_resume));
Method afSuspendMethod = class_getInstanceMethod(self, @selector(af_suspend));
af_addMethod(class, @selector(af_resume), afResumeMethod);
af_addMethod(class, @selector(af_suspend), afSuspendMethod);
af_swizzleSelector(class, @selector(resume), @selector(af_resume));
af_swizzleSelector(class, @selector(suspend), @selector(af_suspend));
if (af_addMethod(theClass, @selector(af_resume), afResumeMethod)) {
af_swizzleSelector(theClass, @selector(resume), @selector(af_resume));
}
if (af_addMethod(theClass, @selector(af_suspend), afSuspendMethod)) {
af_swizzleSelector(theClass, @selector(suspend), @selector(af_suspend));
}
}
- (NSURLSessionTaskState)state {
@ -522,7 +527,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
}
- (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
completionHandler:(AFURLSessionTaskCompletionHandler)completionHandler
{
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
delegate.manager = self;
@ -534,7 +539,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
- (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask
progress:(NSProgress * __autoreleasing *)progress
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
completionHandler:(AFURLSessionTaskCompletionHandler)completionHandler
{
AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init];
delegate.manager = self;
@ -671,7 +676,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
#pragma mark -
- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
completionHandler:(AFURLSessionTaskCompletionHandler)completionHandler
{
__block NSURLSessionDataTask *dataTask = nil;
dispatch_sync(url_session_manager_creation_queue(), ^{
@ -688,7 +693,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
fromFile:(NSURL *)fileURL
progress:(NSProgress * __autoreleasing *)progress
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
completionHandler:(AFURLSessionTaskCompletionHandler)completionHandler
{
__block NSURLSessionUploadTask *uploadTask = nil;
dispatch_sync(url_session_manager_creation_queue(), ^{
@ -709,7 +714,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request
fromData:(NSData *)bodyData
progress:(NSProgress * __autoreleasing *)progress
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
completionHandler:(AFURLSessionTaskCompletionHandler)completionHandler
{
__block NSURLSessionUploadTask *uploadTask = nil;
dispatch_sync(url_session_manager_creation_queue(), ^{
@ -723,7 +728,7 @@ static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofi
- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request
progress:(NSProgress * __autoreleasing *)progress
completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler
completionHandler:(AFURLSessionTaskCompletionHandler)completionHandler
{
__block NSURLSessionUploadTask *uploadTask = nil;
dispatch_sync(url_session_manager_creation_queue(), ^{

View File

@ -2,7 +2,96 @@
All notable changes to this project will be documented in this file.
`AFNetworking` adheres to [Semantic Versioning](http://semver.org/).
---
---
##[2.7.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.3) (2/12/2019)
Released on Tuesday, February 12, 2019. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.7.0+is%3Aclosed).
#### Fixed
* Update Podfile to work on modern CocoaPods
* Fixed by [SlaunchaMan](https://github.com/SlaunchaMan) in [#4329](https://github.com/AFNetworking/AFNetworking/pull/4329).
* Add nullability specifiers to all `id responseObject` parameters
* Fixed by [sashaweiss](https://github.com/sashaweiss) in [#4335](https://github.com/AFNetworking/AFNetworking/pull/4335).
* Fix empty content crash on `AFHTTPSessionManager.post`
* Fixed by [jcravioto](https://github.com/jcravioto) in [#4296](https://github.com/AFNetworking/AFNetworking/pull/4296).
##[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
* Fixed clang analyzer warning suppression that prevented building under some project configurations
* Fixed by [kcharwood](https://github.com/kcharwood) in [#3142](https://github.com/AFNetworking/AFNetworking/pull/3142).
* Restored Xcode 6 compatibility
* 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)
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
* [#3130](https://github.com/AFNetworking/AFNetworking/pull/3130) fixes a swift interop error that does have a breaking API change if you are using Swift. This was [identified](https://github.com/AFNetworking/AFNetworking/issues/3137) after 2.6.2 was released. It changes the method from `throws` to an error pointer, since that method does return an object and also handles an error pointer, which does not play nicely with the Swift/Objective-C error conversion. See [#2810](https://github.com/AFNetworking/AFNetworking/issues/2810) for additional notes. This affects `AFURLRequestionSerializer` and `AFURLResponseSerializer`.
#### Added
* `AFHTTPSessionManager` now copies its `securityPolicy`
* Fixed by [mohamede1945](https://github.com/mohamede1945) in [#2887](https://github.com/AFNetworking/AFNetworking/pull/2887).
#### Updated
* Updated travis to run on 7.1
* Fixed by [kcharwood](https://github.com/kcharwood) in [#3132](https://github.com/AFNetworking/AFNetworking/pull/3132).
* Simplifications of if and return statements in `AFSecurityPolicy`
* Fixed by [TorreyBetts](https://github.com/TorreyBetts) in [#3063](https://github.com/AFNetworking/AFNetworking/pull/3063).
#### Fixed
* Fixed swift interop issue that prevented returning a nil NSURL for a download task
* Fixed by [kcharwood](https://github.com/kcharwood) in [#3133](https://github.com/AFNetworking/AFNetworking/pull/3133).
* Suppressed false positive memory leak warning in Reachability Manager
* Fixed by [kcharwood](https://github.com/kcharwood) in [#3131](https://github.com/AFNetworking/AFNetworking/pull/3131).
* Fixed swift interop issue with throws and Request/Response serialization.
* Fixed by [kcharwood](https://github.com/kcharwood) in [#3130](https://github.com/AFNetworking/AFNetworking/pull/3130).
* Fixed race condition in reachability callback delivery
* Fixed by [MichaelHackett](https://github.com/MichaelHackett) in [#3117](https://github.com/AFNetworking/AFNetworking/pull/3117).
* Fixed URLs that were redirecting in the README
* Fixed by [frankenbot](https://github.com/frankenbot) in [#3109](https://github.com/AFNetworking/AFNetworking/pull/3109).
* Fixed Project Warnings
* Fixed by [kcharwood](https://github.com/kcharwood) in [#3102](https://github.com/AFNetworking/AFNetworking/pull/3102).
* Fixed README link to WWDC session
* Fixed by [wrtsprt](https://github.com/wrtsprt) in [#3099](https://github.com/AFNetworking/AFNetworking/pull/3099).
* Switched from `OS_OBJECT_HAVE_OBJC_SUPPORT` to `OS_OBJECT_USE_OBJC` for watchOS 2 support.
* Fixed by [kylef](https://github.com/kylef) in [#3065](https://github.com/AFNetworking/AFNetworking/pull/3065).
* Added missing __nullable attributes to failure blocks in `AFHTTPRequestOperationManager` and `AFHTTPSessionManager`
* Fixed by [hoppenichu](https://github.com/hoppenichu) in [#3057](https://github.com/AFNetworking/AFNetworking/pull/3057).
* Fixed memory leak in NSURLSession handling
* Fixed by [olegnaumenko](https://github.com/olegnaumenko) in [#2794](https://github.com/AFNetworking/AFNetworking/pull/2794).
## [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
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 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.
* Fixed by [Kevin Harwood](https://github.com/kcharwood) in [#2909](https://github.com/AFNetworking/AFNetworking/issues/2909).
* Added missing nullable attributes to `AFURLRequestSerialization` and `AFURLSessionManager`.
* Fixed by [andrewtoth](https://github.com/andrewtoth) in [#2911](https://github.com/AFNetworking/AFNetworking/pull/2911).
* Migrated to `OS_OBJECT_USE_OBJC`.
* Fixed by [canius](https://github.com/canius) in [#2930](https://github.com/AFNetworking/AFNetworking/pull/2930).
* Added missing nullable tags to UIKit extensions.
* Fixed by [Kevin Harwood](https://github.com/kcharwood) in [#3000](https://github.com/AFNetworking/AFNetworking/pull/3000).
* Fixed potential infinite recursion loop if multiple versions of AFNetworking are loaded in a target.
* Fixed by [Kevin Harwood](https://github.com/kcharwood) in [#2743](https://github.com/AFNetworking/AFNetworking/issues/2743).
* Updated Travis CI test script
* Fixed by [Kevin Harwood](https://github.com/kcharwood) in [#3032](https://github.com/AFNetworking/AFNetworking/issues/3032).
* Migrated to `FOUNDATION_EXPORT` from `extern`.
* Fixed by [Andrey Mikhaylov](https://github.com/pronebird) in [#3041](https://github.com/AFNetworking/AFNetworking/pull/3041).
* Fixed issue where `AFURLConnectionOperation` could get stuck in an infinite loop.
* Fixed by [Mattt Thompson](https://github.com/mattt) in [#2496](https://github.com/AFNetworking/AFNetworking/pull/2496).
* Fixed regression where URL request serialization would crash on iOS 8 for long URLs.
* Fixed by [softenhard](https://github.com/softenhard) in [#3028](https://github.com/AFNetworking/AFNetworking/pull/3028).
## [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).
@ -10,7 +99,7 @@ Released on Wednesday, August 19th, 2015. All issues associated with this milest
###Important Upgrade Notes
Please note the following API/project changes have been made:
* iOS 6 support has now been removed from the podspec. Note that iOS 6 support has not been removed explicitly from the project, but it will be removed in a future update.
* 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.
* **Full Certificate Chain Validation has been removed** from `AFSecurityPolicy`. As discussed in [#2744](https://github.com/AFNetworking/AFNetworking/issues/2744), there was no documented security advantage to pinning against an entire certificate chain. If you were using full certificate chain, please determine and select the most ideal certificate in your chain to pin against.
* Implemented by [Kevin Harwood](https://github.com/kcharwood) in [#2856](https://github.com/AFNetworking/AFNetworking/pull/2856).
* **The request url will now be returned by the `UIImageView` category if the image is returned from cache.** In previous releases, both the request and the response were nil. Going forward, only the response will be nil.

View File

@ -227,7 +227,7 @@
F8129BF21591061B009BFE23 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastUpgradeCheck = 0710;
};
buildConfigurationList = F8129BF51591061B009BFE23 /* Build configuration list for PBXProject "AFNetworking OS X Example" */;
compatibilityVersion = "Xcode 3.2";
@ -297,9 +297,11 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@ -336,6 +338,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@ -357,6 +360,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Prefix.pch;
INFOPLIST_FILE = "Mac-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@ -371,6 +375,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Prefix.pch;
INFOPLIST_FILE = "Mac-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking OS X Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking OS X Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking OS X Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking OS X Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1218,6 +1218,7 @@
29900D261B6FB14000DE5662 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
29900D291B6FB14000DE5662 /* Build configuration list for PBXNativeTarget "AFNetworking watchOS" */ = {
isa = XCConfigurationList;
@ -1226,6 +1227,7 @@
29900D241B6FB14000DE5662 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EBE11F591B62EDD200753127 /* Build configuration list for PBXNativeTarget "Today Extension" */ = {
isa = XCConfigurationList;

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D051B6FB14000DE5662"
BuildableName = "AFNetworking watchOS.app"
BlueprintName = "AFNetworking watchOS"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D111B6FB14000DE5662"
BuildableName = "AFNetworking watchOS Extension.appex"
BlueprintName = "AFNetworking watchOS Extension"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D051B6FB14000DE5662"
BuildableName = "AFNetworking watchOS.app"
BlueprintName = "AFNetworking watchOS"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
RemotePath = "/AFNetworking iOS Example">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D051B6FB14000DE5662"
BuildableName = "AFNetworking watchOS.app"
BlueprintName = "AFNetworking watchOS"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D051B6FB14000DE5662"
BuildableName = "AFNetworking watchOS.app"
BlueprintName = "AFNetworking watchOS"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
RemotePath = "/AFNetworking iOS Example">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D051B6FB14000DE5662"
BuildableName = "AFNetworking watchOS.app"
BlueprintName = "AFNetworking watchOS"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "29900D051B6FB14000DE5662"
BuildableName = "AFNetworking watchOS.app"
BlueprintName = "AFNetworking watchOS"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EBE11F471B62EDD200753127"
BuildableName = "Today Extension.appex"
BlueprintName = "Today Extension"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EBE11F471B62EDD200753127"
BuildableName = "Today Extension.appex"
BlueprintName = "Today Extension"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F8E4695F1395739C00DB05C8"
BuildableName = "AFNetworking iOS Example.app"
BlueprintName = "AFNetworking iOS Example"
ReferencedContainer = "container:AFNetworking iOS Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0.0</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0.0</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>

View File

@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.alamofire.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0.0</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>

View File

@ -27,7 +27,7 @@ Choose AFNetworking for your next project, or migrate over your existing project
### Installation with CocoaPods
[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the ["Getting Started" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking).
[CocoaPods](https://cocoapods.org/) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the ["Getting Started" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking).
#### Podfile
@ -38,11 +38,12 @@ pod "AFNetworking", "~> 2.0"
## Requirements
| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | Notes |
|:--------------------:|:---------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
| 2.x | iOS 6 | OS X 10.8 | Xcode 5 is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. |
| [1.x](https://github.com/AFNetworking/AFNetworking/tree/1.x) | iOS 5 | Mac OS X 10.7 | |
| [0.10.x](https://github.com/AFNetworking/AFNetworking/tree/0.10.x) | iOS 4 | Mac OS X 10.6 | |
| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | watchOS Target | Notes |
|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
| 2.6+ | iOS 7 | OS X 10.9 | watchOS 2.0 | |
| 2.0.0 -> 2.5.4 | iOS 6 | OS X 10.8 | N/A | Xcode 5 is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. |
| [1.x](https://github.com/AFNetworking/AFNetworking/tree/1.x) | iOS 5 | Mac OS X 10.7 | N/A | |
| [0.10.x](https://github.com/AFNetworking/AFNetworking/tree/0.10.x) | iOS 4 | Mac OS X 10.6 | 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)).
@ -263,7 +264,7 @@ NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]};
* Network reachability is a useful tool for determining why a request might have failed.
* After a network request has failed, telling the user they're offline is better than giving them a more technical but accurate error, such as "request timed out."
See also [WWDC 2012 session 706, "Networking Best Practices."](https://developer.apple.com/videos/wwdc/2012/#706).
See also [WWDC 2012 session 706, "Networking Best Practices."](https://developer.apple.com/videos/play/wwdc2012-706/).
#### Shared Network Reachability
@ -360,30 +361,22 @@ NSArray *operations = [AFURLConnectionOperation batchOfRequestOperations:@[...]
## Unit Tests
AFNetworking includes a suite of unit tests within the Tests subdirectory. In order to run the unit tests, you must install the testing dependencies via [CocoaPods](http://cocoapods.org/):
AFNetworking includes a suite of unit tests within the Tests subdirectory. In order to run the unit tests, you must install the testing dependencies via [CocoaPods](https://cocoapods.org/):
$ cd Tests
$ pod install
Once testing dependencies are installed, you can execute the test suite via the 'iOS Tests' and 'OS X Tests' schemes within Xcode.
### Running Tests from the Command Line
Tests can also be run from the command line or within a continuous integration environment. The [`xcpretty`](https://github.com/mneorr/xcpretty) utility needs to be installed before running the tests from the command line:
$ gem install xcpretty
Once `xcpretty` is installed, you can execute the suite via `rake test`.
## Credits
AFNetworking is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org).
AFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://en.wikipedia.org/wiki/Gowalla).
AFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](https://en.wikipedia.org/wiki/Gowalla).
AFNetworking's logo was designed by [Alan Defibaugh](http://www.alandefibaugh.com/).
And most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/contributors).
And most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/graphs/contributors).
### Security Disclosure

View File

@ -1,89 +0,0 @@
include FileUtils::Verbose
namespace :test do
task :prepare do
mkdir_p "Tests/AFNetworking Tests.xcodeproj/xcshareddata/xcschemes"
cp Dir.glob('Tests/Schemes/*.xcscheme'), "Tests/AFNetworking Tests.xcodeproj/xcshareddata/xcschemes/"
end
desc "Run the AFNetworking Tests for iOS"
task :ios => :prepare do
simulators = get_ios_simulators
destinations = Array.new
simulators.each {|version, available_simulators|
destinations.push("platform=iOS Simulator,OS=#{available_simulators[:runtime]},name=#{available_simulators[:device_names][0]}")
puts "Will run tests for iOS Simulator on iOS #{available_simulators[:runtime]} using #{available_simulators[:device_names][0]}"
}
run_tests('iOS Tests', 'iphonesimulator', destinations)
tests_failed('iOS') unless $?.success?
end
desc "Run the AFNetworking Tests for Mac OS X"
task :osx => :prepare do
run_tests('OS X Tests', 'macosx', ['platform=OS X,arch=x86_64'])
tests_failed('OSX') unless $?.success?
end
end
desc "Run the AFNetworking Tests for iOS & Mac OS X"
task :test do
Rake::Task['test:ios'].invoke
Rake::Task['test:osx'].invoke if is_mavericks_or_above
end
task :default => 'test'
private
def run_tests(scheme, sdk, destinations)
destinations = destinations.map! { |destination| "-destination \'#{destination}\'" }.join(' ')
sh("xcodebuild -workspace AFNetworking.xcworkspace -scheme '#{scheme}' -sdk '#{sdk}' #{destinations} -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
end
def is_mavericks_or_above
osx_version = `sw_vers -productVersion`.chomp
Gem::Version.new(osx_version) >= Gem::Version.new('10.9')
end
def tests_failed(platform)
puts red("#{platform} unit tests failed")
exit $?.exitstatus
end
def red(string)
"\033[0;31m! #{string}"
end
def get_ios_simulators
device_section_regex = /== Devices ==(.*?)(?=(?===)|\z)/m
runtime_section_regex = /== Runtimes ==(.*?)(?=(?===)|\z)/m
runtime_version_regex = /iOS (.*) \((.*) - .*?\) (\(.*\))/
xcrun_output = `xcrun simctl list`
puts "Available iOS Simulators: \n#{xcrun_output}"
simulators = Hash.new
runtimes_section = xcrun_output.scan(runtime_section_regex)[0]
runtimes_section[0].scan(runtime_version_regex) {|result|
if result[2] !~ /unavailable/
simulators[result[0]] = Hash.new
simulators[result[0]][:runtime] = result[1]
end
}
device_section = xcrun_output.scan(device_section_regex)[0]
version_regex = /-- iOS (.*?) --(.*?)(?=(?=-- .*? --)|\z)/m
simulator_name_regex = /(.*) \([A-F0-9-]*\) \(.*\)/
device_section[0].scan(version_regex) {|result|
if simulators.has_key?(result[0])
simulators[result[0]][:device_names] = Array.new
result[1].scan(simulator_name_regex) { |device_name_result|
device_name = device_name_result[0].strip
simulators[result[0]][:device_names].push(device_name)
}
end
}
return simulators
end

View File

@ -7,6 +7,12 @@
objects = {
/* Begin PBXBuildFile section */
1F78455521BAD14A00DF7644 /* Let's Encrypt Authority X3.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F78455421BAD14200DF7644 /* Let's Encrypt Authority X3.cer */; };
1F78455621BAD14B00DF7644 /* Let's Encrypt Authority X3.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F78455421BAD14200DF7644 /* Let's Encrypt Authority X3.cer */; };
1F78455721BAD14C00DF7644 /* DST Root CA X3.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F78455321BAD14200DF7644 /* DST Root CA X3.cer */; };
1F78455821BAD14D00DF7644 /* DST Root CA X3.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F78455321BAD14200DF7644 /* DST Root CA X3.cer */; };
1F8482C4220F3A1200718111 /* httpbinorg_04082019.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F8482C3220F3A1200718111 /* httpbinorg_04082019.cer */; };
1F8482C5220F3A1200718111 /* httpbinorg_04082019.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1F8482C3220F3A1200718111 /* httpbinorg_04082019.cer */; };
2902D27917DF4E1100C81C5A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B9ED5C17DF4D350021E4D5 /* XCTest.framework */; };
2902D27A17DF4E1200C81C5A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2544EC35173BE382004117E8 /* Foundation.framework */; };
2902D27B17DF4E1200C81C5A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29133DD617DE77ED006E0493 /* UIKit.framework */; };
@ -34,8 +40,7 @@
36DE264F18053E930062F4E3 /* adn_1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 36DE264C18053E930062F4E3 /* adn_1.cer */; };
36DE265018053E930062F4E3 /* adn_2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 36DE264D18053E930062F4E3 /* adn_2.cer */; };
36DE2652180544600062F4E3 /* AFHTTPRequestOperationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29CBFC3817DF4F120021AB75 /* AFHTTPRequestOperationTests.m */; };
3D56634E3A564CEE86172413 /* libPods-osx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 96A923755B00464187DEDBAF /* libPods-osx.a */; };
6D86BAA5C6174E98AE719CE9 /* libPods-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 55E73C267F33406A9F92476C /* libPods-ios.a */; };
6027ACFF999DA75E3F9E527D /* libPods-iOS Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 01BE740B4CCF820D2799B0A7 /* libPods-iOS Tests.a */; };
77D65EBC1848A03C004CA024 /* AFPropertyListResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D65EBB1848A03C004CA024 /* AFPropertyListResponseSerializerTests.m */; };
77D65EBD1848A03C004CA024 /* AFPropertyListResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D65EBB1848A03C004CA024 /* AFPropertyListResponseSerializerTests.m */; };
943B1F41192E406C00304316 /* AFURLSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 943B1F40192E406C00304316 /* AFURLSessionManagerTests.m */; };
@ -52,14 +57,9 @@
C61291641B21E27700B9475A /* AFUIImageViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C61291631B21E27700B9475A /* AFUIImageViewTests.m */; };
C61291651B21F9E300B9475A /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = F8C6F281174D2C6200B154D5 /* Icon.png */; };
C61291661B21FA4D00B9475A /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = F8C6F281174D2C6200B154D5 /* Icon.png */; };
CBBDB1651A7981FB00D412EE /* httpbinorg_01162016.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1641A7981E200D412EE /* httpbinorg_01162016.cer */; };
CBBDB1661A79820700D412EE /* httpbinorg_01162016.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1641A7981E200D412EE /* httpbinorg_01162016.cer */; };
CBBDB16A1A798AB500D412EE /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1671A798AB500D412EE /* AddTrust_External_CA_Root.cer */; };
CBBDB16B1A798AB500D412EE /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1671A798AB500D412EE /* AddTrust_External_CA_Root.cer */; };
CBBDB16C1A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1681A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer */; };
CBBDB16D1A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1681A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer */; };
CBBDB16E1A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1691A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; };
CBBDB16F1A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBBDB1691A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; };
DDA47FA750DA771844B622D2 /* libPods-OS X Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F87FC2F6293AA9FC47279C60 /* libPods-OS X Tests.a */; };
DE533FCE1ACCF34200C62CFB /* AFNetworkReachabilityManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE533FCD1ACCF34200C62CFB /* AFNetworkReachabilityManagerTests.m */; };
DE533FCF1ACCF34200C62CFB /* AFNetworkReachabilityManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE533FCD1ACCF34200C62CFB /* AFNetworkReachabilityManagerTests.m */; };
F837FFAF195744A0009078A0 /* AFHTTPResponseSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F837FFAE195744A0009078A0 /* AFHTTPResponseSerializationTests.m */; };
@ -68,6 +68,10 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
01BE740B4CCF820D2799B0A7 /* libPods-iOS Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-iOS Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
1F78455321BAD14200DF7644 /* DST Root CA X3.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "DST Root CA X3.cer"; sourceTree = "<group>"; };
1F78455421BAD14200DF7644 /* Let's Encrypt Authority X3.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Let's Encrypt Authority X3.cer"; sourceTree = "<group>"; };
1F8482C3220F3A1200718111 /* httpbinorg_04082019.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = httpbinorg_04082019.cer; sourceTree = "<group>"; };
2544EC35173BE382004117E8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
2544EC44173BE382004117E8 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
2544EC80173BFAA8004117E8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
@ -117,6 +121,7 @@
520A0FB27D040CF3258787D2 /* Pods-osx.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-osx.debug.xcconfig"; path = "Pods/Target Support Files/Pods-osx/Pods-osx.debug.xcconfig"; sourceTree = "<group>"; };
55E73C267F33406A9F92476C /* libPods-ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ios.a"; sourceTree = BUILT_PRODUCTS_DIR; };
77D65EBB1848A03C004CA024 /* AFPropertyListResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFPropertyListResponseSerializerTests.m; sourceTree = "<group>"; };
7C9E49663B2E7FA3096E7381 /* Pods-OS X Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OS X Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OS X Tests/Pods-OS X Tests.debug.xcconfig"; sourceTree = "<group>"; };
943B1F40192E406C00304316 /* AFURLSessionManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLSessionManagerTests.m; sourceTree = "<group>"; };
95D45FB81CA3594FA8CF7430 /* Pods-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ios/Pods-ios.debug.xcconfig"; sourceTree = "<group>"; };
96A923755B00464187DEDBAF /* libPods-osx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-osx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -127,13 +132,14 @@
BC9AB30A551203E10B6C890E /* Pods-osx.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-osx.release.xcconfig"; path = "Pods/Target Support Files/Pods-osx/Pods-osx.release.xcconfig"; sourceTree = "<group>"; };
C280748C740FAD506581E3CE /* Pods-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-ios/Pods-ios.release.xcconfig"; sourceTree = "<group>"; };
C61291631B21E27700B9475A /* AFUIImageViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFUIImageViewTests.m; sourceTree = "<group>"; };
CBBDB1641A7981E200D412EE /* httpbinorg_01162016.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = httpbinorg_01162016.cer; sourceTree = "<group>"; };
CBBDB1671A798AB500D412EE /* AddTrust_External_CA_Root.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AddTrust_External_CA_Root.cer; sourceTree = "<group>"; };
CBBDB1681A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Certification_Authority.cer; sourceTree = "<group>"; };
CBBDB1691A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Domain_Validation_Secure_Server_CA.cer; sourceTree = "<group>"; };
D2CB7FD4971678533B812949 /* Pods-iOS Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-iOS Tests/Pods-iOS Tests.release.xcconfig"; sourceTree = "<group>"; };
DBB49C2ECB1A13CFA66943ED /* Pods-OS X Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OS X Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-OS X Tests/Pods-OS X Tests.release.xcconfig"; sourceTree = "<group>"; };
DE533FCD1ACCF34200C62CFB /* AFNetworkReachabilityManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkReachabilityManagerTests.m; sourceTree = "<group>"; };
E1A31F8A319EF4B49FE24CA9 /* Pods-iOS Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iOS Tests/Pods-iOS Tests.debug.xcconfig"; sourceTree = "<group>"; };
F837FFAE195744A0009078A0 /* AFHTTPResponseSerializationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPResponseSerializationTests.m; sourceTree = "<group>"; };
F87382941948AC15000B7AFA /* AFHTTPSessionManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPSessionManagerTests.m; sourceTree = "<group>"; };
F87FC2F6293AA9FC47279C60 /* libPods-OS X Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OS X Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F8C6F281174D2C6200B154D5 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = ../Example/Icon.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -145,7 +151,7 @@
2902D27917DF4E1100C81C5A /* XCTest.framework in Frameworks */,
2902D27B17DF4E1200C81C5A /* UIKit.framework in Frameworks */,
2902D27A17DF4E1200C81C5A /* Foundation.framework in Frameworks */,
6D86BAA5C6174E98AE719CE9 /* libPods-ios.a in Frameworks */,
6027ACFF999DA75E3F9E527D /* libPods-iOS Tests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -155,7 +161,7 @@
files = (
2902D28D17DF4E2900C81C5A /* XCTest.framework in Frameworks */,
2902D28E17DF4E2A00C81C5A /* Foundation.framework in Frameworks */,
3D56634E3A564CEE86172413 /* libPods-osx.a in Frameworks */,
DDA47FA750DA771844B622D2 /* libPods-OS X Tests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -206,6 +212,8 @@
55E73C267F33406A9F92476C /* libPods-ios.a */,
96A923755B00464187DEDBAF /* libPods-osx.a */,
2B6D24F8E1B74E10A269E8B3 /* libPods.a */,
F87FC2F6293AA9FC47279C60 /* libPods-OS X Tests.a */,
01BE740B4CCF820D2799B0A7 /* libPods-iOS Tests.a */,
);
name = Frameworks;
sourceTree = "<group>";
@ -308,9 +316,9 @@
isa = PBXGroup;
children = (
CBBDB1671A798AB500D412EE /* AddTrust_External_CA_Root.cer */,
CBBDB1681A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer */,
CBBDB1691A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */,
CBBDB1641A7981E200D412EE /* httpbinorg_01162016.cer */,
1F78455321BAD14200DF7644 /* DST Root CA X3.cer */,
1F78455421BAD14200DF7644 /* Let's Encrypt Authority X3.cer */,
1F8482C3220F3A1200718111 /* httpbinorg_04082019.cer */,
29CBFC7517DF697C0021AB75 /* HTTPBinOrgServerTrustChain */,
);
name = HTTPBin.org;
@ -333,6 +341,10 @@
C280748C740FAD506581E3CE /* Pods-ios.release.xcconfig */,
520A0FB27D040CF3258787D2 /* Pods-osx.debug.xcconfig */,
BC9AB30A551203E10B6C890E /* Pods-osx.release.xcconfig */,
7C9E49663B2E7FA3096E7381 /* Pods-OS X Tests.debug.xcconfig */,
DBB49C2ECB1A13CFA66943ED /* Pods-OS X Tests.release.xcconfig */,
E1A31F8A319EF4B49FE24CA9 /* Pods-iOS Tests.debug.xcconfig */,
D2CB7FD4971678533B812949 /* Pods-iOS Tests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
@ -365,11 +377,11 @@
isa = PBXNativeTarget;
buildConfigurationList = 2902D28717DF4E1200C81C5A /* Build configuration list for PBXNativeTarget "iOS Tests" */;
buildPhases = (
0B8FAAA6FAFB34F7F5637B58 /* [CP] Check Pods Manifest.lock */,
54CD36584E3B40719F14C3C9 /* Check Pods Manifest.lock */,
2902D27417DF4E1100C81C5A /* Sources */,
2902D27517DF4E1100C81C5A /* Frameworks */,
2902D27617DF4E1100C81C5A /* Resources */,
DFF6BB8B6C8D4F8ABC235667 /* Copy Pods Resources */,
);
buildRules = (
);
@ -384,11 +396,11 @@
isa = PBXNativeTarget;
buildConfigurationList = 2902D29917DF4E2A00C81C5A /* Build configuration list for PBXNativeTarget "OS X Tests" */;
buildPhases = (
7F267BFFD062AD7254BC0C78 /* [CP] Check Pods Manifest.lock */,
6949C05DBEB94BC2BAE81768 /* Check Pods Manifest.lock */,
2902D28817DF4E2900C81C5A /* Sources */,
2902D28917DF4E2900C81C5A /* Frameworks */,
2902D28A17DF4E2900C81C5A /* Resources */,
D728EB5862164B87922C9B80 /* Copy Pods Resources */,
);
buildRules = (
);
@ -435,15 +447,15 @@
29CBFC8717DF74C60021AB75 /* ADNNetServerTrustChain in Resources */,
A74DA00D18D2FB9400F3B969 /* NoDomains.cer in Resources */,
2902D28117DF4E1200C81C5A /* InfoPlist.strings in Resources */,
CBBDB1651A7981FB00D412EE /* httpbinorg_01162016.cer in Resources */,
36DE264E18053E930062F4E3 /* adn_0.cer in Resources */,
36DE264F18053E930062F4E3 /* adn_1.cer in Resources */,
CBBDB16C1A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer in Resources */,
CBBDB16E1A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */,
1F8482C4220F3A1200718111 /* httpbinorg_04082019.cer in Resources */,
A74DA00B18D2FB9400F3B969 /* foobar.com.cer in Resources */,
1F78455721BAD14C00DF7644 /* DST Root CA X3.cer in Resources */,
36DE265018053E930062F4E3 /* adn_2.cer in Resources */,
29CBFC7617DF697C0021AB75 /* HTTPBinOrgServerTrustChain in Resources */,
C61291651B21F9E300B9475A /* Icon.png in Resources */,
1F78455521BAD14A00DF7644 /* Let's Encrypt Authority X3.cer in Resources */,
A74DA00918D2FB9400F3B969 /* AltName.cer in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -456,15 +468,15 @@
29CBFC8817DF74C60021AB75 /* ADNNetServerTrustChain in Resources */,
A74DA00E18D2FB9400F3B969 /* NoDomains.cer in Resources */,
2902D29517DF4E2A00C81C5A /* InfoPlist.strings in Resources */,
CBBDB1661A79820700D412EE /* httpbinorg_01162016.cer in Resources */,
B6C1B95718ABF9E300C8B21A /* adn_0.cer in Resources */,
B6C1B95818ABF9E300C8B21A /* adn_1.cer in Resources */,
CBBDB16D1A798AB500D412EE /* COMODO_RSA_Certification_Authority.cer in Resources */,
CBBDB16F1A798AB500D412EE /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */,
1F8482C5220F3A1200718111 /* httpbinorg_04082019.cer in Resources */,
A74DA00C18D2FB9400F3B969 /* foobar.com.cer in Resources */,
1F78455821BAD14D00DF7644 /* DST Root CA X3.cer in Resources */,
B6C1B95918ABF9E300C8B21A /* adn_2.cer in Resources */,
29CBFC7717DF697C0021AB75 /* HTTPBinOrgServerTrustChain in Resources */,
C61291661B21FA4D00B9475A /* Icon.png in Resources */,
1F78455621BAD14B00DF7644 /* Let's Encrypt Authority X3.cer in Resources */,
A74DA00A18D2FB9400F3B969 /* AltName.cer in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -472,6 +484,28 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0B8FAAA6FAFB34F7F5637B58 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-iOS Tests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
54CD36584E3B40719F14C3C9 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -502,34 +536,26 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
D728EB5862164B87922C9B80 /* Copy Pods Resources */ = {
7F267BFFD062AD7254BC0C78 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-OS X Tests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-osx/Pods-osx-resources.sh\"\n";
showEnvVarsInLog = 0;
};
DFF6BB8B6C8D4F8ABC235667 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ios/Pods-ios-resources.sh\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@ -649,7 +675,7 @@
};
2902D28517DF4E1200C81C5A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 95D45FB81CA3594FA8CF7430 /* Pods-ios.debug.xcconfig */;
baseConfigurationReference = E1A31F8A319EF4B49FE24CA9 /* Pods-iOS Tests.debug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -678,7 +704,7 @@
};
2902D28617DF4E1200C81C5A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = C280748C740FAD506581E3CE /* Pods-ios.release.xcconfig */;
baseConfigurationReference = D2CB7FD4971678533B812949 /* Pods-iOS Tests.release.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -704,7 +730,7 @@
};
2902D29A17DF4E2A00C81C5A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 520A0FB27D040CF3258787D2 /* Pods-osx.debug.xcconfig */;
baseConfigurationReference = 7C9E49663B2E7FA3096E7381 /* Pods-OS X Tests.debug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -734,7 +760,7 @@
};
2902D29B17DF4E2A00C81C5A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = BC9AB30A551203E10B6C890E /* Pods-osx.release.xcconfig */;
baseConfigurationReference = DBB49C2ECB1A13CFA66943ED /* Pods-OS X Tests.release.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2902D28B17DF4E2900C81C5A"
BuildableName = "OS X Tests.xctest"
BlueprintName = "OS X Tests"
ReferencedContainer = "container:AFNetworking Tests.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2902D27717DF4E1100C81C5A"
BuildableName = "iOS Tests.xctest"
BlueprintName = "iOS Tests"
ReferencedContainer = "container:AFNetworking Tests.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,6 +1,6 @@
source 'https://github.com/CocoaPods/Specs'
xcodeproj 'AFNetworking Tests'
project 'AFNetworking Tests'
workspace '../AFNetworking'
inhibit_all_warnings!
@ -10,14 +10,12 @@ def import_pods
pod 'AFNetworking', :path => '../'
end
target :ios do
target 'iOS Tests' do
platform :ios, '7.0'
link_with 'iOS Tests'
import_pods
end
target :osx do
target 'OS X Tests' do
platform :osx, '10.9'
link_with 'OS X Tests'
import_pods
end

47
Tests/Podfile.lock Normal file
View File

@ -0,0 +1,47 @@
PODS:
- AFNetworking (2.7.0):
- AFNetworking/NSURLConnection (= 2.7.0)
- AFNetworking/NSURLSession (= 2.7.0)
- AFNetworking/Reachability (= 2.7.0)
- AFNetworking/Security (= 2.7.0)
- AFNetworking/Serialization (= 2.7.0)
- AFNetworking/UIKit (= 2.7.0)
- AFNetworking/NSURLConnection (2.7.0):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/NSURLSession (2.7.0):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (2.7.0)
- AFNetworking/Security (2.7.0)
- AFNetworking/Serialization (2.7.0)
- AFNetworking/UIKit (2.7.0):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- Expecta (0.2.4)
- OCMock (2.1.1)
DEPENDENCIES:
- AFNetworking (from `../`)
- Expecta (~> 0.2.1)
- OCMock (~> 2.1.1)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Expecta
- OCMock
EXTERNAL SOURCES:
AFNetworking:
:path: "../"
SPEC CHECKSUMS:
AFNetworking: 8dd5f9b9691e09186393069a12cc3b5ed7c8b511
Expecta: cfaf1d3e2e194ca704a25e997093d30a1ce70b61
OCMock: add4220c4527115d16e40a21dab18cb6f829d476
PODFILE CHECKSUM: c94ccd39e1ee81e51a0aa5dc9d53f130474dea3f
COCOAPODS: 1.6.0

Binary file not shown.

Binary file not shown.

View File

@ -65,6 +65,34 @@
#pragma mark -
- (void)testThatAFHTTPRequestSerializationSerializesPOSTRequestsProperly {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]];
request.HTTPMethod = @"POST";
NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:request withParameters:@{@"key":@"value"} error:nil];
NSString *contentType = serializedRequest.allHTTPHeaderFields[@"Content-Type"];
XCTAssertNotNil(contentType);
XCTAssertEqualObjects(contentType, @"application/x-www-form-urlencoded");
XCTAssertNotNil(serializedRequest.HTTPBody);
XCTAssertEqualObjects(serializedRequest.HTTPBody, [@"key=value" dataUsingEncoding:NSUTF8StringEncoding]);
}
- (void)testThatAFHTTPRequestSerializationSerializesPOSTRequestsProperlyWhenNoParameterIsProvided {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]];
request.HTTPMethod = @"POST";
NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:request withParameters:nil error:nil];
NSString *contentType = serializedRequest.allHTTPHeaderFields[@"Content-Type"];
XCTAssertNotNil(contentType);
XCTAssertEqualObjects(contentType, @"application/x-www-form-urlencoded");
XCTAssertNotNil(serializedRequest.HTTPBody);
XCTAssertEqualObjects(serializedRequest.HTTPBody, [NSData data]);
}
- (void)testThatAFHTTPRequestSerialiationSerializesQueryParametersCorrectly {
NSURLRequest *originalRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]];
NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:originalRequest withParameters:@{@"key":@"value"} error:nil];
@ -148,4 +176,22 @@
expect(error).to.equal(serializerError);
}
#pragma mark - #3028 tests
//https://github.com/AFNetworking/AFNetworking/pull/3028
- (void)testThatEmojiIsProperlyEncoded {
//Start with an odd number of characters so we can cross the 50 character boundry
NSMutableString *parameter = [NSMutableString stringWithString:@"!"];
while (parameter.length < 50) {
[parameter appendString:@"👴🏿👷🏻👮🏽"];
}
AFHTTPRequestSerializer *serializer = [AFHTTPRequestSerializer serializer];
NSURLRequest *request = [serializer requestWithMethod:@"GET"
URLString:@"http://test.com"
parameters:@{@"test":parameter}
error:nil];
XCTAssertTrue([request.URL.query isEqualToString:@"test=%21%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD"]);
}
@end

View File

@ -139,6 +139,26 @@
expect(downloadFilePath).willNot.beNil();
}
- (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];
return @"";
}];
NSURLSessionTask *nilTask;
nilTask = [self.manager
GET:@"test"
parameters:@{@"key":@"value"}
success:nil
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
XCTAssertNil(task);
[expectation fulfill];
}];
XCTAssertNil(nilTask);
[self waitForExpectationsWithTimeout:10.0 handler:nil];
}
@end

View File

@ -22,12 +22,11 @@
#import "AFTestCase.h"
#import "AFNetworkActivityIndicatorManager.h"
#import "AFHTTPRequestOperation.h"
#import "AFHTTPSessionManager.h"
@interface AFNetworkActivityManagerTests : AFTestCase
@property (nonatomic, strong) AFNetworkActivityIndicatorManager *networkActivityIndicatorManager;
@property (nonatomic, assign) BOOL isNetworkActivityIndicatorVisible;
@property (nonatomic, strong) id mockApplication;
@property (nonatomic, strong) AFHTTPSessionManager *sessionManager;
@end
#pragma mark -
@ -37,71 +36,63 @@
- (void)setUp {
[super setUp];
self.sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:self.baseURL sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
self.networkActivityIndicatorManager = [[AFNetworkActivityIndicatorManager alloc] init];
self.networkActivityIndicatorManager.enabled = YES;
self.mockApplication = [OCMockObject mockForClass:[UIApplication class]];
[[[self.mockApplication stub] andReturn:self.mockApplication] sharedApplication];
[[[self.mockApplication stub] andDo:^(NSInvocation *invocation) {
[invocation setReturnValue:(void *)&_isNetworkActivityIndicatorVisible];
}] isNetworkActivityIndicatorVisible];
[[[self.mockApplication stub] andDo:^(NSInvocation *invocation) {
[invocation getArgument:&_isNetworkActivityIndicatorVisible atIndex:2];
}] setNetworkActivityIndicatorVisible:YES];
}
- (void)tearDown {
[super tearDown];
[self.mockApplication stopMocking];
self.mockApplication = nil;
self.networkActivityIndicatorManager = nil;
[self.sessionManager invalidateSessionCancelingTasks:YES];
}
#pragma mark -
- (void)testThatNetworkActivityIndicatorTurnsOffIndicatorWhenRequestSucceeds {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/get" relativeToURL:self.baseURL]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
expect([self.mockApplication isNetworkActivityIndicatorVisible]).will.beFalsy();
} failure:nil];
XCTestExpectation *requestCompleteExpectation = [self expectationWithDescription:@"Request should succeed"];
[self.sessionManager
GET:@"/delay/1"
parameters:nil
success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
[requestCompleteExpectation fulfill];
}
failure:nil];
[self expectationForPredicate:[NSPredicate predicateWithFormat:@"isNetworkActivityIndicatorVisible == YES"]
evaluatedWithObject:self.networkActivityIndicatorManager
handler:nil];
[self waitForExpectationsWithTimeout:10.0 handler:nil];
[operation start];
expect([self.mockApplication isNetworkActivityIndicatorVisible]).will.beTruthy();
[self expectationForPredicate:[NSPredicate predicateWithFormat:@"isNetworkActivityIndicatorVisible == NO"]
evaluatedWithObject:self.networkActivityIndicatorManager
handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}
- (void)testThatNetworkActivityIndicatorTurnsOffIndicatorWhenRequestFails {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/status/500" relativeToURL:self.baseURL]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:nil failure:^(AFHTTPRequestOperation *operation, NSError *error) {
expect([self.mockApplication isNetworkActivityIndicatorVisible]).will.beFalsy();
}];
XCTestExpectation *requestCompleteExpectation = [self expectationWithDescription:@"Request should succeed"];
[self.sessionManager
GET:@"/status/500"
parameters:nil
success:nil
failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) {
[requestCompleteExpectation fulfill];
}];
[operation start];
[self
keyValueObservingExpectationForObject:self.networkActivityIndicatorManager
keyPath:@"isNetworkActivityIndicatorVisible"
handler:^BOOL(AFNetworkActivityIndicatorManager * observedObject, NSDictionary * _Nonnull change) {
return observedObject.isNetworkActivityIndicatorVisible;
}];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
expect([self.mockApplication isNetworkActivityIndicatorVisible]).will.beTruthy();
}
- (void)testThatNetworkActivityIsUnchangedWhenManagerIsDisabled {
self.networkActivityIndicatorManager.enabled = NO;
__block BOOL didChangeNetworkActivityIndicatorVisible = NO;
[[[self.mockApplication stub] andDo:^(NSInvocation *invocation) {
didChangeNetworkActivityIndicatorVisible = YES;
}] setNetworkActivityIndicatorVisible:YES];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/get" relativeToURL:self.baseURL]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:nil failure:nil];
[operation start];
expect(didChangeNetworkActivityIndicatorVisible).will.beFalsy();
[self expectationForPredicate:[NSPredicate predicateWithFormat:@"isNetworkActivityIndicatorVisible == NO"]
evaluatedWithObject:self.networkActivityIndicatorManager
handler:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
}
@end

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;
@ -54,6 +55,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");
@ -71,15 +86,9 @@
handler:^BOOL(NSNotification *note) {
AFNetworkReachabilityStatus status;
status = [note.userInfo[AFNetworkingReachabilityNotificationStatusItem] integerValue];
BOOL reachable = (status == AFNetworkReachabilityStatusReachableViaWiFi
|| status == AFNetworkReachabilityStatusReachableViaWWAN);
XCTAssert(reachable,
@"Expected network to be reachable but got '%@'",
AFStringFromNetworkReachabilityStatus(status));
XCTAssertEqual(reachable, manager.isReachable, @"Expected status to match 'isReachable'");
return YES;
BOOL isReachable = (status == AFNetworkReachabilityStatusReachableViaWiFi
|| status == AFNetworkReachabilityStatusReachableViaWWAN);
return isReachable;
}];
[manager startMonitoring];
@ -97,17 +106,15 @@
- (void)verifyReachabilityStatusBlockGetsCalledWithManager:(AFNetworkReachabilityManager *)manager
{
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];

View File

@ -58,23 +58,23 @@ static SecTrustRef AFUTADNNetServerTrust() {
}
static SecCertificateRef AFUTHTTPBinOrgCertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"httpbinorg_01162016" ofType:@"cer"];
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"httpbinorg_04082019" 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 AFLetsEncryptSecureServerCertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"Let's Encrypt Authority X3" 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 AFDSTRootCACertificate() {
NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"DST Root CA X3" ofType:@"cer"];
NSCAssert(certPath != nil, @"Path for certificate should not be nil");
NSData *certData = [NSData dataWithContentsOfFile:certPath];
@ -223,7 +223,7 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate1CertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
SecCertificateRef certificate = AFLetsEncryptSecureServerCertificate();
policy.pinnedCertificates = @[ (__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
@ -231,7 +231,7 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate2CertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTCOMODORSACertificate();
SecCertificateRef certificate = AFDSTRootCACertificate();
policy.pinnedCertificates = @[ (__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
@ -239,7 +239,7 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgRootCertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef certificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef certificate = AFDSTRootCACertificate();
policy.pinnedCertificates = @[ (__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
@ -248,8 +248,8 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey];
SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate();
SecCertificateRef intermedaite1Certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
SecCertificateRef intermedaite2Certificate = AFUTCOMODORSACertificate();
SecCertificateRef intermedaite1Certificate = AFLetsEncryptSecureServerCertificate();
SecCertificateRef intermedaite2Certificate = AFDSTRootCACertificate();
SecCertificateRef rootCertificate = AFUTAddTrustExternalRootCertificate();
[policy setPinnedCertificates:@[(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite1Certificate),
@ -344,7 +344,7 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate1CertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
SecCertificateRef certificate = AFLetsEncryptSecureServerCertificate();
policy.pinnedCertificates = @[ (__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
@ -352,7 +352,7 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate2CertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTCOMODORSACertificate();
SecCertificateRef certificate = AFDSTRootCACertificate();
policy.pinnedCertificates = @[ (__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
@ -360,7 +360,7 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgRootCertificatePinned {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef certificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef certificate = AFDSTRootCACertificate();
policy.pinnedCertificates = @[ (__bridge_transfer id)SecCertificateCopyData(certificate)];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust");
}
@ -369,12 +369,10 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate();
SecCertificateRef intermedaite1Certificate = AFUTCOMODORSADomainValidationSecureServerCertificate();
SecCertificateRef intermedaite2Certificate = AFUTCOMODORSACertificate();
SecCertificateRef rootCertificate = AFUTAddTrustExternalRootCertificate();
SecCertificateRef intermedaiteCertificate = AFLetsEncryptSecureServerCertificate();
SecCertificateRef rootCertificate = AFDSTRootCACertificate();
[policy setPinnedCertificates:@[(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite1Certificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaite2Certificate),
(__bridge_transfer NSData *)SecCertificateCopyData(intermedaiteCertificate),
(__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate)]];
XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid");
@ -441,11 +439,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];
@ -561,4 +554,41 @@ static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) {
XCTAssertFalse([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should not allow server trust because invalid certificates are allowed but there are no pinned certificates");
}
#pragma mark - NSCopying
- (void)testThatPolicyCanBeCopied {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
policy.allowInvalidCertificates = YES;
policy.validatesDomainName = NO;
AFSecurityPolicy *copiedPolicy = [policy copy];
XCTAssertNotEqual(copiedPolicy, policy);
XCTAssertEqual(copiedPolicy.allowInvalidCertificates, policy.allowInvalidCertificates);
XCTAssertEqual(copiedPolicy.validatesDomainName, policy.validatesDomainName);
XCTAssertEqual(copiedPolicy.SSLPinningMode, policy.SSLPinningMode);
XCTAssertNotEqual(copiedPolicy.pinnedCertificates, policy.pinnedCertificates);
XCTAssertTrue([copiedPolicy.pinnedCertificates isEqualToArray:policy.pinnedCertificates]);
}
- (void)testThatPolicyCanBeEncodedAndDecoded {
AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];
policy.allowInvalidCertificates = YES;
policy.validatesDomainName = NO;
NSMutableData *archiveData = [NSMutableData new];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:archiveData];
[archiver encodeObject:policy forKey:@"policy"];
[archiver finishEncoding];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:archiveData];
AFSecurityPolicy *unarchivedPolicy = [unarchiver decodeObjectOfClass:[AFSecurityPolicy class] forKey:@"policy"];
XCTAssertNotEqual(unarchivedPolicy, policy);
XCTAssertEqual(unarchivedPolicy.allowInvalidCertificates, policy.allowInvalidCertificates);
XCTAssertEqual(unarchivedPolicy.validatesDomainName, policy.validatesDomainName);
XCTAssertEqual(unarchivedPolicy.SSLPinningMode, policy.SSLPinningMode);
XCTAssertNotEqual(unarchivedPolicy.pinnedCertificates, policy.pinnedCertificates);
XCTAssertTrue([unarchivedPolicy.pinnedCertificates isEqualToArray:policy.pinnedCertificates]);
}
@end

View File

@ -59,18 +59,24 @@
- (void)testSetImageWithURLRequestUsesCachedImage {
XCTestExpectation *expectation = [self expectationWithDescription:@"Image view uses cached image"];
typeof(self) __weak weakSelf = self;
__block NSURLRequest *responseRequest = nil;
__block UIImage *responseImage = nil;
__block NSHTTPURLResponse *urlResponse;
[self.imageView
setImageWithURLRequest:self.cachedImageRequest
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
XCTAssertEqual(request, weakSelf.cachedImageRequest, @"URL requests do not match");
XCTAssertNil(response, @"Response should be nil when image is returned from cache");
XCTAssertEqual(image, weakSelf.cachedImage, @"Cached images do not match");
responseRequest = request;
responseImage = image;
urlResponse = response;
[expectation fulfill];
}
failure:nil];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
XCTAssertEqual(responseRequest, self.cachedImageRequest, @"URL requests do not match");
XCTAssertNil(urlResponse, @"Response should be nil when image is returned from cache");
XCTAssertEqual(responseImage, self.cachedImage, @"Cached images do not match");
}
@end

View File

@ -187,7 +187,7 @@ static const char * af_backgroundImageRequestOperationKeyForState(UIControlState
__weak __typeof(self)weakSelf = self;
AFHTTPRequestOperation *imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
imageRequestOperation.responseSerializer = self.imageResponseSerializer;
[imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
[imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __nullable responseObject) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if ([[urlRequest URL] isEqual:[operation.request URL]]) {
if (success) {
@ -253,7 +253,7 @@ static const char * af_backgroundImageRequestOperationKeyForState(UIControlState
__weak __typeof(self)weakSelf = self;
AFHTTPRequestOperation *backgroundImageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
backgroundImageRequestOperation.responseSerializer = self.imageResponseSerializer;
[backgroundImageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
[backgroundImageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __nullable responseObject) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if ([[urlRequest URL] isEqual:[operation.request URL]]) {
if (success) {

View File

@ -143,7 +143,7 @@
__weak __typeof(self)weakSelf = self;
self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
self.af_imageRequestOperation.responseSerializer = self.imageResponseSerializer;
[self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
[self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __nullable responseObject) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if ([[urlRequest URL] isEqual:[strongSelf.af_imageRequestOperation.request URL]]) {
if (success) {