25 files modified
1 files renamed
4 files deleted
5 files added
| | |
| | | Pod::Spec.new do |s| |
| | | |
| | | s.name = 'WASdkImpl_CN' |
| | | s.version = '1.2.1' |
| | | s.version = '1.3.0' |
| | | s.summary = 'WASdkImpl_CN framework in testing environment.' |
| | | s.license = 'MIT' |
| | | s.author = { "Hank" => "hank.zhang@gamehollywood.com" } |
| | |
| | | s.resources = ['config/*.xml','bundle/WASDK-Resource.bundle','localizable/*.plist'] |
| | | s.libraries = 'sqlite3','z' |
| | | s.requires_arc = true |
| | | s.dependency 'WASdkIntf_CN', '~> 1.2.1' |
| | | s.dependency 'WASdkIntf_CN', '~> 1.3.0' |
| | | |
| | | end |
New file |
| | |
| | | # |
| | | # Be sure to run `pod spec lint WASdkImpl.podspec' to ensure this is a |
| | | # valid spec and to remove all comments including this before submitting the spec. |
| | | # |
| | | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html |
| | | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ |
| | | # |
| | | |
| | | Pod::Spec.new do |s| |
| | | |
| | | s.name = 'WASdkImpl_CN' |
| | | s.version = '1.3.0' |
| | | s.summary = 'WASdkImpl_CN framework in testing environment.' |
| | | s.license = 'MIT' |
| | | s.author = { "Hank" => "hank.zhang@gamehollywood.com" } |
| | | s.homepage = 'http://repo.wingsdk.cn:8082/summary/WASdkImpl_CN.git' |
| | | s.source = { :git => "http://admin@repo.wingsdk.cn:8082/r/WASdkImpl_CN.git" , :tag => s.version} |
| | | s.platform = :ios |
| | | s.ios.deployment_target = "7.0" |
| | | s.vendored_frameworks = 'frameworks/*.framework' |
| | | s.resources = ['config/*.xml','bundle/WASDK-Resource.bundle','localizable/*.plist'] |
| | | s.libraries = 'sqlite3','z' |
| | | s.requires_arc = true |
| | | s.dependency 'WASdkIntf_CN', '~> 1.3.0' |
| | | |
| | | end |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <config> |
| | | <version val="WA1.2.1"/> |
| | | <version val="WA1.3.0"/> |
| | | <comps> |
| | | <!-- 用户模块 --> |
| | | <comp module="USR" plaf="WINGA" mandatory="YES" value="WASdkUser" desc="WINGA用户账户"/> |
New file |
| | |
| | | // AFAutoPurgingImageCache.h |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | | // in the Software without restriction, including without limitation the rights |
| | | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| | | // copies of the Software, and to permit persons to whom the Software is |
| | | // furnished to do so, subject to the following conditions: |
| | | // |
| | | // The above copyright notice and this permission notice shall be included in |
| | | // all copies or substantial portions of the Software. |
| | | // |
| | | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| | | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| | | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| | | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| | | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| | | // THE SOFTWARE. |
| | | |
| | | #import <TargetConditionals.h> |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | /** |
| | | The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously. |
| | | */ |
| | | @protocol AFImageCache <NSObject> |
| | | |
| | | /** |
| | | Adds the image to the cache with the given identifier. |
| | | |
| | | @param image The image to cache. |
| | | @param identifier The unique identifier for the image in the cache. |
| | | */ |
| | | - (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier; |
| | | |
| | | /** |
| | | Removes the image from the cache matching the given identifier. |
| | | |
| | | @param identifier The unique identifier for the image in the cache. |
| | | |
| | | @return A BOOL indicating whether or not the image was removed from the cache. |
| | | */ |
| | | - (BOOL)removeImageWithIdentifier:(NSString *)identifier; |
| | | |
| | | /** |
| | | Removes all images from the cache. |
| | | |
| | | @return A BOOL indicating whether or not all images were removed from the cache. |
| | | */ |
| | | - (BOOL)removeAllImages; |
| | | |
| | | /** |
| | | Returns the image in the cache associated with the given identifier. |
| | | |
| | | @param identifier The unique identifier for the image in the cache. |
| | | |
| | | @return An image for the matching identifier, or nil. |
| | | */ |
| | | - (nullable UIImage *)imageWithIdentifier:(NSString *)identifier; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier. |
| | | */ |
| | | @protocol AFImageRequestCache <AFImageCache> |
| | | |
| | | /** |
| | | Asks if the image should be cached using an identifier created from the request and additional identifier. |
| | | |
| | | @param image The image to be cached. |
| | | @param request The unique URL request identifing the image asset. |
| | | @param identifier The additional identifier to apply to the URL request to identify the image. |
| | | |
| | | @return A BOOL indicating whether or not the image should be added to the cache. YES will cache, NO will prevent caching. |
| | | */ |
| | | - (BOOL)shouldCacheImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; |
| | | |
| | | /** |
| | | Adds the image to the cache using an identifier created from the request and additional identifier. |
| | | |
| | | @param image The image to cache. |
| | | @param request The unique URL request identifing the image asset. |
| | | @param identifier The additional identifier to apply to the URL request to identify the image. |
| | | */ |
| | | - (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; |
| | | |
| | | /** |
| | | Removes the image from the cache using an identifier created from the request and additional identifier. |
| | | |
| | | @param request The unique URL request identifing the image asset. |
| | | @param identifier The additional identifier to apply to the URL request to identify the image. |
| | | |
| | | @return A BOOL indicating whether or not all images were removed from the cache. |
| | | */ |
| | | - (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; |
| | | |
| | | /** |
| | | Returns the image from the cache associated with an identifier created from the request and additional identifier. |
| | | |
| | | @param request The unique URL request identifing the image asset. |
| | | @param identifier The additional identifier to apply to the URL request to identify the image. |
| | | |
| | | @return An image for the matching request and identifier, or nil. |
| | | */ |
| | | - (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; |
| | | |
| | | @end |
| | | |
| | | /** |
| | | The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated. |
| | | */ |
| | | @interface AFAutoPurgingImageCache : NSObject <AFImageRequestCache> |
| | | |
| | | /** |
| | | The total memory capacity of the cache in bytes. |
| | | */ |
| | | @property (nonatomic, assign) UInt64 memoryCapacity; |
| | | |
| | | /** |
| | | The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit. |
| | | */ |
| | | @property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge; |
| | | |
| | | /** |
| | | The current total memory usage in bytes of all images stored within the cache. |
| | | */ |
| | | @property (nonatomic, assign, readonly) UInt64 memoryUsage; |
| | | |
| | | /** |
| | | Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`. |
| | | |
| | | @return The new `AutoPurgingImageCache` instance. |
| | | */ |
| | | - (instancetype)init; |
| | | |
| | | /** |
| | | Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage |
| | | after purge limit. |
| | | |
| | | @param memoryCapacity The total memory capacity of the cache in bytes. |
| | | @param preferredMemoryCapacity The preferred memory usage after purge in bytes. |
| | | |
| | | @return The new `AutoPurgingImageCache` instance. |
| | | */ |
| | | - (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity; |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
| | | |
| | | #endif |
| | | |
New file |
| | |
| | | // AFCompatibilityMacros.h |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | | // in the Software without restriction, including without limitation the rights |
| | | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| | | // copies of the Software, and to permit persons to whom the Software is |
| | | // furnished to do so, subject to the following conditions: |
| | | // |
| | | // The above copyright notice and this permission notice shall be included in |
| | | // all copies or substantial portions of the Software. |
| | | // |
| | | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| | | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| | | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| | | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| | | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| | | // THE SOFTWARE. |
| | | |
| | | #ifndef AFCompatibilityMacros_h |
| | | #define AFCompatibilityMacros_h |
| | | |
| | | #ifdef API_UNAVAILABLE |
| | | #define AF_API_UNAVAILABLE(x) API_UNAVAILABLE(x) |
| | | #else |
| | | #define AF_API_UNAVAILABLE(x) |
| | | #endif // API_UNAVAILABLE |
| | | |
| | | #if __has_warning("-Wunguarded-availability-new") |
| | | #define AF_CAN_USE_AT_AVAILABLE 1 |
| | | #else |
| | | #define AF_CAN_USE_AT_AVAILABLE 0 |
| | | #endif |
| | | |
| | | #if ((__IPHONE_OS_VERSION_MAX_ALLOWED && __IPHONE_OS_VERSION_MAX_ALLOWED < 100000) || (__MAC_OS_VERSION_MAX_ALLOWED && __MAC_OS_VERSION_MAX_ALLOWED < 101200) ||(__WATCH_OS_MAX_VERSION_ALLOWED && __WATCH_OS_MAX_VERSION_ALLOWED < 30000) ||(__TV_OS_MAX_VERSION_ALLOWED && __TV_OS_MAX_VERSION_ALLOWED < 100000)) |
| | | #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 0 |
| | | #else |
| | | #define AF_CAN_INCLUDE_SESSION_TASK_METRICS 1 |
| | | #endif |
| | | |
| | | #endif /* AFCompatibilityMacros_h */ |
old mode 100755
new mode 100644
| | |
| | | // AFHTTPSessionManager.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | #if !TARGET_OS_WATCH |
| | | #import <SystemConfiguration/SystemConfiguration.h> |
| | | #endif |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if __IPHONE_OS_VERSION_MIN_REQUIRED |
| | | #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV |
| | | #import <MobileCoreServices/MobileCoreServices.h> |
| | | #else |
| | | #import <CoreServices/CoreServices.h> |
| | | #endif |
| | | |
| | | #import "AFURLSessionManager.h" |
| | | |
| | | #ifndef NS_DESIGNATED_INITIALIZER |
| | | #if __has_attribute(objc_designated_initializer) |
| | | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) |
| | | #else |
| | | #define NS_DESIGNATED_INITIALIZER |
| | | #endif |
| | | #endif |
| | | |
| | | /** |
| | | `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths. |
| | |
| | | |
| | | ## Methods to Override |
| | | |
| | | To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`. |
| | | To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`. |
| | | |
| | | ## Serialization |
| | | |
| | |
| | | @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance. |
| | | */ |
| | | |
| | | #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || TARGET_OS_WATCH |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | @interface AFHTTPSessionManager : AFURLSessionManager <NSSecureCoding, NSCopying> |
| | |
| | | @warning `responseSerializer` must not be `nil`. |
| | | */ |
| | | @property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer; |
| | | |
| | | ///------------------------------- |
| | | /// @name Managing Security Policy |
| | | ///------------------------------- |
| | | |
| | | /** |
| | | The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate` can only be applied on a session manager initialized with a secure base URL (i.e. https). Applying a security policy with pinning enabled on an insecure session manager throws an `Invalid Security Policy` exception. |
| | | */ |
| | | @property (nonatomic, strong) AFSecurityPolicy *securityPolicy; |
| | | |
| | | ///--------------------- |
| | | /// @name Initialization |
| | |
| | | */ |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `GET` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)GET:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `GET` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)GET:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. |
| | |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | success:(nullable void (^)(NSURLSessionDataTask *task))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `POST` request. |
| | |
| | | */ |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `POST` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `POST` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. |
| | |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. |
| | | @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. |
| | | @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `PUT` request. |
| | |
| | | */ |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `PUT` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. |
| | |
| | | */ |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. |
| | |
| | | */ |
| | | - (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 DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. |
| | | |
| | | @param URLString The URL string used to create the request URL. |
| | | @param parameters The parameters to be encoded according to the client request serializer. |
| | | @param headers The headers appended to the default headers for this request. |
| | | @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. |
| | | @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. |
| | | |
| | | @see -dataTaskWithRequest:completionHandler: |
| | | */ |
| | | - (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | headers:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success |
| | | failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
| | | |
| | | #endif |
New file |
| | |
| | | // AFImageDownloader.h |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | | // in the Software without restriction, including without limitation the rights |
| | | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| | | // copies of the Software, and to permit persons to whom the Software is |
| | | // furnished to do so, subject to the following conditions: |
| | | // |
| | | // The above copyright notice and this permission notice shall be included in |
| | | // all copies or substantial portions of the Software. |
| | | // |
| | | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| | | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| | | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| | | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| | | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| | | // THE SOFTWARE. |
| | | |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import "AFAutoPurgingImageCache.h" |
| | | #import "AFHTTPSessionManager.h" |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) { |
| | | AFImageDownloadPrioritizationFIFO, |
| | | AFImageDownloadPrioritizationLIFO |
| | | }; |
| | | |
| | | /** |
| | | The `AFImageDownloadReceipt` is an object vended by the `AFImageDownloader` when starting a data task. It can be used to cancel active tasks running on the `AFImageDownloader` session. As a general rule, image data tasks should be cancelled using the `AFImageDownloadReceipt` instead of calling `cancel` directly on the `task` itself. The `AFImageDownloader` is optimized to handle duplicate task scenarios as well as pending versus active downloads. |
| | | */ |
| | | @interface AFImageDownloadReceipt : NSObject |
| | | |
| | | /** |
| | | The data task created by the `AFImageDownloader`. |
| | | */ |
| | | @property (nonatomic, strong) NSURLSessionDataTask *task; |
| | | |
| | | /** |
| | | The unique identifier for the success and failure blocks when duplicate requests are made. |
| | | */ |
| | | @property (nonatomic, strong) NSUUID *receiptID; |
| | | @end |
| | | |
| | | /** The `AFImageDownloader` class is responsible for downloading images in parallel on a prioritized queue. Incoming downloads are added to the front or back of the queue depending on the download prioritization. Each downloaded image is cached in the underlying `NSURLCache` as well as the in-memory image cache. By default, any download request with a cached image equivalent in the image cache will automatically be served the cached image representation. |
| | | */ |
| | | @interface AFImageDownloader : NSObject |
| | | |
| | | /** |
| | | The image cache used to store all downloaded images in. `AFAutoPurgingImageCache` by default. |
| | | */ |
| | | @property (nonatomic, strong, nullable) id <AFImageRequestCache> imageCache; |
| | | |
| | | /** |
| | | The `AFHTTPSessionManager` used to download images. By default, this is configured with an `AFImageResponseSerializer`, and a shared `NSURLCache` for all image downloads. |
| | | */ |
| | | @property (nonatomic, strong) AFHTTPSessionManager *sessionManager; |
| | | |
| | | /** |
| | | Defines the order prioritization of incoming download requests being inserted into the queue. `AFImageDownloadPrioritizationFIFO` by default. |
| | | */ |
| | | @property (nonatomic, assign) AFImageDownloadPrioritization downloadPrioritizaton; |
| | | |
| | | /** |
| | | The shared default instance of `AFImageDownloader` initialized with default values. |
| | | */ |
| | | + (instancetype)defaultInstance; |
| | | |
| | | /** |
| | | Creates a default `NSURLCache` with common usage parameter values. |
| | | |
| | | @returns The default `NSURLCache` instance. |
| | | */ |
| | | + (NSURLCache *)defaultURLCache; |
| | | |
| | | /** |
| | | The default `NSURLSessionConfiguration` with common usage parameter values. |
| | | */ |
| | | + (NSURLSessionConfiguration *)defaultURLSessionConfiguration; |
| | | |
| | | /** |
| | | Default initializer |
| | | |
| | | @return An instance of `AFImageDownloader` initialized with default values. |
| | | */ |
| | | - (instancetype)init; |
| | | |
| | | /** |
| | | Initializer with specific `URLSessionConfiguration` |
| | | |
| | | @param configuration The `NSURLSessionConfiguration` to be be used |
| | | |
| | | @return An instance of `AFImageDownloader` initialized with default values and custom `NSURLSessionConfiguration` |
| | | */ |
| | | - (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration; |
| | | |
| | | /** |
| | | Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache. |
| | | |
| | | @param sessionManager The session manager to use to download images. |
| | | @param downloadPrioritization The download prioritization of the download queue. |
| | | @param maximumActiveDownloads The maximum number of active downloads allowed at any given time. Recommend `4`. |
| | | @param imageCache The image cache used to store all downloaded images in. |
| | | |
| | | @return The new `AFImageDownloader` instance. |
| | | */ |
| | | - (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager |
| | | downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization |
| | | maximumActiveDownloads:(NSInteger)maximumActiveDownloads |
| | | imageCache:(nullable id <AFImageRequestCache>)imageCache; |
| | | |
| | | /** |
| | | Creates a data task using the `sessionManager` instance for the specified URL request. |
| | | |
| | | If the same data task is already in the queue or currently being downloaded, the success and failure blocks are |
| | | appended to the already existing task. Once the task completes, all success or failure blocks attached to the |
| | | task are executed in the order they were added. |
| | | |
| | | @param request The URL request. |
| | | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. |
| | | |
| | | @return The image download receipt for the data task if available. `nil` if the image is stored in the cache. |
| | | cache and the URL request cache policy allows the cache to be used. |
| | | */ |
| | | - (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success |
| | | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; |
| | | |
| | | /** |
| | | Creates a data task using the `sessionManager` instance for the specified URL request. |
| | | |
| | | If the same data task is already in the queue or currently being downloaded, the success and failure blocks are |
| | | appended to the already existing task. Once the task completes, all success or failure blocks attached to the |
| | | task are executed in the order they were added. |
| | | |
| | | @param request The URL request. |
| | | @param receiptID The identifier to use for the download receipt that will be created for this request. This must be a unique identifier that does not represent any other request. |
| | | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. |
| | | |
| | | @return The image download receipt for the data task if available. `nil` if the image is stored in the cache. |
| | | cache and the URL request cache policy allows the cache to be used. |
| | | */ |
| | | - (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request |
| | | withReceiptID:(NSUUID *)receiptID |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success |
| | | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; |
| | | |
| | | /** |
| | | Cancels the data task in the receipt by removing the corresponding success and failure blocks and cancelling the data task if necessary. |
| | | |
| | | If the data task is pending in the queue, it will be cancelled if no other success and failure blocks are registered with the data task. If the data task is currently executing or is already completed, the success and failure blocks are removed and will not be called when the task finishes. |
| | | |
| | | @param imageDownloadReceipt The image download receipt to cancel. |
| | | */ |
| | | - (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt; |
| | | |
| | | @end |
| | | |
| | | #endif |
| | | |
| | | NS_ASSUME_NONNULL_END |
old mode 100755
new mode 100644
| | |
| | | // AFNetworkActivityIndicatorManager.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | /** |
| | | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. |
| | | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. |
| | | |
| | | You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code: |
| | | |
| | |
| | | @property (nonatomic, assign, getter = isEnabled) BOOL enabled; |
| | | |
| | | /** |
| | | A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. |
| | | A Boolean value indicating whether the network activity indicator manager is currently active. |
| | | */ |
| | | @property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; |
| | | |
| | | /** |
| | | A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds. |
| | | |
| | | Apple's HIG describes the following: |
| | | |
| | | > Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence. |
| | | |
| | | */ |
| | | @property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; |
| | | @property (nonatomic, assign) NSTimeInterval activationDelay; |
| | | |
| | | /** |
| | | A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds. |
| | | */ |
| | | |
| | | @property (nonatomic, assign) NSTimeInterval completionDelay; |
| | | |
| | | /** |
| | | Returns the shared network activity indicator manager object for the system. |
| | |
| | | */ |
| | | - (void)decrementActivityCount; |
| | | |
| | | /** |
| | | Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward. |
| | | |
| | | @param block A block to be executed when the network activity indicator status changes. |
| | | */ |
| | | - (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block; |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
old mode 100755
new mode 100644
| | |
| | | // AFNetworkReachabilityManager.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | #if !TARGET_OS_WATCH |
| | | #import <SystemConfiguration/SystemConfiguration.h> |
| | | |
| | | #ifndef NS_DESIGNATED_INITIALIZER |
| | | #if __has_attribute(objc_designated_initializer) |
| | | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) |
| | | #else |
| | | #define NS_DESIGNATED_INITIALIZER |
| | | #endif |
| | | #endif |
| | | |
| | | typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { |
| | | AFNetworkReachabilityStatusUnknown = -1, |
| | | AFNetworkReachabilityStatusNotReachable = 0, |
| | |
| | | |
| | | Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability. |
| | | |
| | | See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/) |
| | | See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ ) |
| | | |
| | | @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. |
| | | */ |
| | |
| | | + (instancetype)sharedManager; |
| | | |
| | | /** |
| | | Creates and returns a network reachability manager with the default socket address. |
| | | |
| | | @return An initialized network reachability manager, actively monitoring the default socket address. |
| | | */ |
| | | + (instancetype)manager; |
| | | |
| | | /** |
| | | Creates and returns a network reachability manager for the specified domain. |
| | | |
| | | @param domain The domain used to evaluate network reachability. |
| | |
| | | /** |
| | | Creates and returns a network reachability manager for the socket address. |
| | | |
| | | @param address The socket address (`sockaddr_in`) used to evaluate network reachability. |
| | | @param address The socket address (`sockaddr_in6`) used to evaluate network reachability. |
| | | |
| | | @return An initialized network reachability manager, actively monitoring the specified socket address. |
| | | */ |
| | |
| | | @return An initialized network reachability manager, actively monitoring the specified reachability. |
| | | */ |
| | | - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER; |
| | | |
| | | /** |
| | | * Unavailable initializer |
| | | */ |
| | | + (instancetype)new NS_UNAVAILABLE; |
| | | |
| | | /** |
| | | * Unavailable initializer |
| | | */ |
| | | - (instancetype)init NS_UNAVAILABLE; |
| | | |
| | | ///-------------------------------------------------- |
| | | /// @name Starting & Stopping Reachability Monitoring |
| | |
| | | |
| | | @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 |
| | |
| | | /** |
| | | 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 |
old mode 100755
new mode 100644
| | |
| | | // AFNetworking.h |
| | | // |
| | | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) |
| | | // |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // 3.2.1 |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | | // in the Software without restriction, including without limitation the rights |
| | | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| | | // copies of the Software, and to permit persons to whom the Software is |
| | | // furnished to do so, subject to the following conditions: |
| | | // |
| | | // |
| | | // The above copyright notice and this permission notice shall be included in |
| | | // all copies or substantial portions of the Software. |
| | | // |
| | | // |
| | | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| | | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| | | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| | |
| | | // THE SOFTWARE. |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | //! Project version number for AFNetworking. |
| | | FOUNDATION_EXPORT double AFNetworkingVersionNumber; |
| | | |
| | | //! Project version string for AFNetworking. |
| | | FOUNDATION_EXPORT const unsigned char AFNetworkingVersionString[]; |
| | | |
| | | // In this header, you should import all the public headers of your framework using statements like #import <AFNetworking/PublicHeader.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #ifndef _AFNETWORKING_ |
| | | #define _AFNETWORKING_ |
| | | #define _AFNETWORKING_ |
| | | |
| | | #import "AFURLRequestSerialization.h" |
| | | #import "AFURLResponseSerialization.h" |
| | | #import "AFSecurityPolicy.h" |
| | | #import <AFNetworking/AFURLRequestSerialization.h> |
| | | #import <AFNetworking/AFURLResponseSerialization.h> |
| | | #import <AFNetworking/AFSecurityPolicy.h> |
| | | #import <AFNetworking/AFCompatibilityMacros.h> |
| | | |
| | | #if !TARGET_OS_WATCH |
| | | #import "AFNetworkReachabilityManager.h" |
| | | #import "AFURLConnectionOperation.h" |
| | | #import "AFHTTPRequestOperation.h" |
| | | #import "AFHTTPRequestOperationManager.h" |
| | | #import <AFNetworking/AFNetworkReachabilityManager.h> |
| | | #endif |
| | | |
| | | #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ |
| | | ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) || \ |
| | | TARGET_OS_WATCH ) |
| | | #import "AFURLSessionManager.h" |
| | | #import "AFHTTPSessionManager.h" |
| | | #import <AFNetworking/AFURLSessionManager.h> |
| | | #import <AFNetworking/AFHTTPSessionManager.h> |
| | | |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | #import <AFNetworking/AFAutoPurgingImageCache.h> |
| | | #import <AFNetworking/AFImageDownloader.h> |
| | | #import <AFNetworking/UIActivityIndicatorView+AFNetworking.h> |
| | | #import <AFNetworking/UIButton+AFNetworking.h> |
| | | #import <AFNetworking/UIImage+AFNetworking.h> |
| | | #import <AFNetworking/UIImageView+AFNetworking.h> |
| | | #import <AFNetworking/UIProgressView+AFNetworking.h> |
| | | #endif |
| | | |
| | | #if TARGET_OS_IOS |
| | | #import <AFNetworking/AFNetworkActivityIndicatorManager.h> |
| | | #import <AFNetworking/UIRefreshControl+AFNetworking.h> |
| | | #import <AFNetworking/UIWebView+AFNetworking.h> |
| | | #endif |
| | | |
| | | |
| | | #endif /* _AFNETWORKING_ */ |
old mode 100755
new mode 100644
| | |
| | | // AFSecurityPolicy.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | 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`. |
| | |
| | | @property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode; |
| | | |
| | | /** |
| | | The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the app bundle. Note that if you create an array with duplicate certificates, the duplicate certificates will be removed. Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. |
| | | The certificates used to evaluate server trust according to the SSL pinning mode. |
| | | |
| | | By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`. |
| | | |
| | | Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSArray *pinnedCertificates; |
| | | @property (nonatomic, strong, nullable) NSSet <NSData *> *pinnedCertificates; |
| | | |
| | | /** |
| | | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. |
| | |
| | | Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`. |
| | | */ |
| | | @property (nonatomic, assign) BOOL validatesDomainName; |
| | | |
| | | ///----------------------------------------- |
| | | /// @name Getting Certificates from the Bundle |
| | | ///----------------------------------------- |
| | | |
| | | /** |
| | | Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`. |
| | | |
| | | @return The certificates included in the given bundle. |
| | | */ |
| | | + (NSSet <NSData *> *)certificatesInBundle:(NSBundle *)bundle; |
| | | |
| | | ///----------------------------------------- |
| | | /// @name Getting Specific Security Policies |
| | |
| | | */ |
| | | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; |
| | | |
| | | /** |
| | | Creates and returns a security policy with the specified pinning mode. |
| | | |
| | | @param pinningMode The SSL pinning mode. |
| | | @param pinnedCertificates The certificates to pin against. |
| | | |
| | | @return A new security policy. |
| | | */ |
| | | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates; |
| | | |
| | | ///------------------------------ |
| | | /// @name Evaluating Server Trust |
| | | ///------------------------------ |
| | | |
| | | /** |
| | | Whether or not the specified server trust should be accepted, based on the security policy. |
| | | |
| | | This method should be used when responding to an authentication challenge from a server. |
| | | |
| | | @param serverTrust The X.509 certificate trust of the server. |
| | | |
| | | @return Whether or not to trust the server. |
| | | |
| | | @warning This method has been deprecated in favor of `-evaluateServerTrust:forDomain:`. |
| | | */ |
| | | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Whether or not the specified server trust should be accepted, based on the security policy. |
old mode 100755
new mode 100644
| | |
| | | // AFURLRequestSerialization.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | // THE SOFTWARE. |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #if TARGET_OS_IOS |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | #import <UIKit/UIKit.h> |
| | | #elif TARGET_OS_WATCH |
| | | #import <WatchKit/WatchKit.h> |
| | | #endif |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | /** |
| | | Returns a percent-escaped string following RFC 3986 for a query string key or value. |
| | | RFC 3986 states that the following characters are "reserved" characters. |
| | | - General Delimiters: ":", "#", "[", "]", "@", "?", "/" |
| | | - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" |
| | | |
| | | In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow |
| | | query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" |
| | | should be percent-escaped in the query string. |
| | | |
| | | @param string The string to be percent-escaped. |
| | | |
| | | @return The percent-escaped string. |
| | | */ |
| | | FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string); |
| | | |
| | | /** |
| | | A helper method to generate encoded url query parameters for appending to the end of a URL. |
| | | |
| | | @param parameters A dictionary of key/values to be encoded. |
| | | |
| | | @return A url encoded query string |
| | | */ |
| | | FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters); |
| | | |
| | | /** |
| | | The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary. |
| | |
| | | */ |
| | | - (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request |
| | | withParameters:(nullable id)parameters |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; |
| | | |
| | | @end |
| | | |
| | |
| | | |
| | | @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`. |
| | | */ |
| | | @property (readonly, nonatomic, strong) NSDictionary *HTTPRequestHeaders; |
| | | @property (readonly, nonatomic, strong) NSDictionary <NSString *, NSString *> *HTTPRequestHeaders; |
| | | |
| | | /** |
| | | Creates and returns a serializer with default configuration. |
| | |
| | | password:(NSString *)password; |
| | | |
| | | /** |
| | | @deprecated This method has been deprecated. Use -setValue:forHTTPHeaderField: instead. |
| | | */ |
| | | - (void)setAuthorizationHeaderFieldWithToken:(NSString *)token DEPRECATED_ATTRIBUTE; |
| | | |
| | | |
| | | /** |
| | | Clears any existing value for the "Authorization" HTTP header. |
| | | */ |
| | | - (void)clearAuthorizationHeader; |
| | |
| | | /** |
| | | HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default. |
| | | */ |
| | | @property (nonatomic, strong) NSSet *HTTPMethodsEncodingParametersInURI; |
| | | @property (nonatomic, strong) NSSet <NSString *> *HTTPMethodsEncodingParametersInURI; |
| | | |
| | | /** |
| | | Set the method of query string serialization according to one of the pre-defined styles. |
| | |
| | | ///------------------------------- |
| | | |
| | | /** |
| | | @deprecated This method has been deprecated. Use -requestWithMethod:URLString:parameters:error: instead. |
| | | */ |
| | | - (NSMutableURLRequest *)requestWithMethod:(NSString *)method |
| | | URLString:(NSString *)URLString |
| | | parameters:(id)parameters DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string. |
| | | |
| | | If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body. |
| | |
| | | - (NSMutableURLRequest *)requestWithMethod:(NSString *)method |
| | | URLString:(NSString *)URLString |
| | | parameters:(nullable id)parameters |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | |
| | | /** |
| | | @deprecated This method has been deprecated. Use -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error: instead. |
| | | */ |
| | | - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method |
| | | URLString:(NSString *)URLString |
| | | parameters:(NSDictionary *)parameters |
| | | constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block DEPRECATED_ATTRIBUTE; |
| | | error:(NSError * _Nullable __autoreleasing *)error; |
| | | |
| | | /** |
| | | Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 |
| | |
| | | */ |
| | | - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method |
| | | URLString:(NSString *)URLString |
| | | parameters:(nullable NSDictionary *)parameters |
| | | parameters:(nullable NSDictionary <NSString *, id> *)parameters |
| | | constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | error:(NSError * _Nullable __autoreleasing *)error; |
| | | |
| | | /** |
| | | Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished. |
| | |
| | | */ |
| | | - (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request |
| | | writingStreamContentsToFile:(NSURL *)fileURL |
| | | completionHandler:(nullable void (^)(NSError * __nullable error))handler; |
| | | completionHandler:(nullable void (^)(NSError * _Nullable error))handler; |
| | | |
| | | @end |
| | | |
| | |
| | | */ |
| | | - (BOOL)appendPartWithFileURL:(NSURL *)fileURL |
| | | name:(NSString *)name |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | error:(NSError * _Nullable __autoreleasing *)error; |
| | | |
| | | /** |
| | | Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. |
| | |
| | | name:(NSString *)name |
| | | fileName:(NSString *)fileName |
| | | mimeType:(NSString *)mimeType |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | error:(NSError * _Nullable __autoreleasing *)error; |
| | | |
| | | /** |
| | | Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary. |
| | |
| | | @param headers The HTTP headers to be appended to the form data. |
| | | @param body The data to be encoded and appended to the form data. This parameter must not be `nil`. |
| | | */ |
| | | - (void)appendPartWithHeaders:(nullable NSDictionary *)headers |
| | | - (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headers |
| | | body:(NSData *)body; |
| | | |
| | | /** |
| | |
| | | `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 |
| | |
| | | `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 |
| | |
| | | `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 |
old mode 100755
new mode 100644
| | |
| | | // AFURLResponseSerialization.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | /** |
| | | Recursively removes `NSNull` values from a JSON object. |
| | | */ |
| | | id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions); |
| | | |
| | | /** |
| | | The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. |
| | | |
| | | For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object. |
| | |
| | | */ |
| | | - (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response |
| | | data:(nullable NSData *)data |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; |
| | | |
| | | @end |
| | | |
| | |
| | | |
| | | - (instancetype)init; |
| | | |
| | | /** |
| | | The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default. |
| | | */ |
| | | @property (nonatomic, assign) NSStringEncoding stringEncoding; |
| | | @property (nonatomic, assign) NSStringEncoding stringEncoding DEPRECATED_MSG_ATTRIBUTE("The string encoding is never used. AFHTTPResponseSerializer only validates status codes and content types but does not try to decode the received data in any way."); |
| | | |
| | | /** |
| | | Creates and returns a serializer with default configuration. |
| | |
| | | /** |
| | | The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation. |
| | | */ |
| | | @property (nonatomic, copy, nullable) NSSet *acceptableContentTypes; |
| | | @property (nonatomic, copy, nullable) NSSet <NSString *> *acceptableContentTypes; |
| | | |
| | | /** |
| | | Validates the specified response and data. |
| | |
| | | */ |
| | | - (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response |
| | | data:(nullable NSData *)data |
| | | error:(NSError * __nullable __autoreleasing *)error; |
| | | error:(NSError * _Nullable __autoreleasing *)error; |
| | | |
| | | @end |
| | | |
| | |
| | | - `application/json` |
| | | - `text/json` |
| | | - `text/javascript` |
| | | |
| | | In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the `NSJSONSerialization` documentation for more details. |
| | | */ |
| | | @interface AFJSONResponseSerializer : AFHTTPResponseSerializer |
| | | |
| | |
| | | - (instancetype)init; |
| | | |
| | | /** |
| | | Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. |
| | | Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSXMLDocument` documentation section "Input and Output Options". `0` by default. |
| | | */ |
| | | @property (nonatomic, assign) NSUInteger options; |
| | | |
| | |
| | | */ |
| | | @interface AFImageResponseSerializer : AFHTTPResponseSerializer |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH |
| | | /** |
| | | The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. |
| | | */ |
| | |
| | | /** |
| | | The component response serializers. |
| | | */ |
| | | @property (readonly, nonatomic, copy) NSArray *responseSerializers; |
| | | @property (readonly, nonatomic, copy) NSArray <id<AFURLResponseSerialization>> *responseSerializers; |
| | | |
| | | /** |
| | | Creates and returns a compound serializer comprised of the specified response serializers. |
| | | |
| | | @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`. |
| | | */ |
| | | + (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers; |
| | | + (instancetype)compoundSerializerWithResponseSerializers:(NSArray <id<AFURLResponseSerialization>> *)responseSerializers; |
| | | |
| | | @end |
| | | |
| | |
| | | `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 |
| | |
| | | `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 |
old mode 100755
new mode 100644
| | |
| | | // AFURLSessionManager.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| | | // THE SOFTWARE. |
| | | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import "AFURLResponseSerialization.h" |
| | | #import "AFURLRequestSerialization.h" |
| | | #import "AFSecurityPolicy.h" |
| | | #import "AFCompatibilityMacros.h" |
| | | #if !TARGET_OS_WATCH |
| | | #import "AFNetworkReachabilityManager.h" |
| | | #endif |
| | | |
| | | #ifndef NS_DESIGNATED_INITIALIZER |
| | | #if __has_attribute(objc_designated_initializer) |
| | | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) |
| | | #else |
| | | #define NS_DESIGNATED_INITIALIZER |
| | | #endif |
| | | #endif |
| | | |
| | | /** |
| | |
| | | - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:` |
| | | - `URLSession:task:didReceiveChallenge:completionHandler:` |
| | | - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:` |
| | | - `URLSession:task:needNewBodyStream:` |
| | | - `URLSession:task:didCompleteWithError:` |
| | | |
| | | ### `NSURLSessionDataDelegate` |
| | |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || TARGET_OS_WATCH |
| | | |
| | | @interface AFURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSSecureCoding, NSCopying> |
| | | |
| | | /** |
| | |
| | | ///------------------------------- |
| | | |
| | | /** |
| | | The security policy used by created request operations to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. |
| | | The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. |
| | | */ |
| | | @property (nonatomic, strong) AFSecurityPolicy *securityPolicy; |
| | | |
| | |
| | | /** |
| | | The data, upload, and download tasks currently run by the managed session. |
| | | */ |
| | | @property (readonly, nonatomic, strong) NSArray *tasks; |
| | | @property (readonly, nonatomic, strong) NSArray <NSURLSessionTask *> *tasks; |
| | | |
| | | /** |
| | | The data tasks currently run by the managed session. |
| | | */ |
| | | @property (readonly, nonatomic, strong) NSArray *dataTasks; |
| | | @property (readonly, nonatomic, strong) NSArray <NSURLSessionDataTask *> *dataTasks; |
| | | |
| | | /** |
| | | The upload tasks currently run by the managed session. |
| | | */ |
| | | @property (readonly, nonatomic, strong) NSArray *uploadTasks; |
| | | @property (readonly, nonatomic, strong) NSArray <NSURLSessionUploadTask *> *uploadTasks; |
| | | |
| | | /** |
| | | The download tasks currently run by the managed session. |
| | | */ |
| | | @property (readonly, nonatomic, strong) NSArray *downloadTasks; |
| | | @property (readonly, nonatomic, strong) NSArray <NSURLSessionDownloadTask *> *downloadTasks; |
| | | |
| | | ///------------------------------- |
| | | /// @name Managing Callback Queues |
| | |
| | | /** |
| | | The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used. |
| | | */ |
| | | #if OS_OBJECT_HAVE_OBJC_SUPPORT |
| | | @property (nonatomic, strong, nullable) dispatch_queue_t completionQueue; |
| | | #else |
| | | @property (nonatomic, assign, nullable) dispatch_queue_t completionQueue; |
| | | #endif |
| | | |
| | | /** |
| | | The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used. |
| | | */ |
| | | #if OS_OBJECT_HAVE_OBJC_SUPPORT |
| | | @property (nonatomic, strong, nullable) dispatch_group_t completionGroup; |
| | | #else |
| | | @property (nonatomic, assign, nullable) dispatch_group_t completionGroup; |
| | | #endif |
| | | |
| | | ///--------------------------------- |
| | | /// @name Working Around System Bugs |
| | |
| | | |
| | | @param cancelPendingTasks Whether or not to cancel pending tasks. |
| | | */ |
| | | - (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks; |
| | | - (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Invalidates the managed session, optionally canceling pending tasks and optionally resets given session. |
| | | |
| | | @param cancelPendingTasks Whether or not to cancel pending tasks. |
| | | @param resetSession Whether or not to reset the session of the manager. |
| | | */ |
| | | - (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession; |
| | | |
| | | ///------------------------- |
| | | /// @name Running Data Tasks |
| | |
| | | @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. |
| | | */ |
| | | - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id __nullable responseObject, NSError * __nullable error))completionHandler; |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Creates an `NSURLSessionDataTask` with the specified request. |
| | | |
| | | @param request The HTTP request for the request. |
| | | @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. |
| | | */ |
| | | - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request |
| | | uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock |
| | | downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; |
| | | |
| | | ///--------------------------- |
| | | /// @name Running Upload Tasks |
| | |
| | | |
| | | @param request The HTTP request for the request. |
| | | @param fileURL A URL to the local file to be uploaded. |
| | | @param progress A progress object monitoring the current upload progress. |
| | | @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. |
| | | |
| | | @see `attemptsToRecreateUploadTasksForBackgroundSessions` |
| | | */ |
| | | - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request |
| | | fromFile:(NSURL *)fileURL |
| | | progress:(NSProgress * __nullable __autoreleasing * __nullable)progress |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id __nullable responseObject, NSError * __nullable error))completionHandler; |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; |
| | | |
| | | /** |
| | | Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body. |
| | | |
| | | @param request The HTTP request for the request. |
| | | @param bodyData A data object containing the HTTP body to be uploaded. |
| | | @param progress A progress object monitoring the current upload progress. |
| | | @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. |
| | | */ |
| | | - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request |
| | | fromData:(nullable NSData *)bodyData |
| | | progress:(NSProgress * __nullable __autoreleasing * __nullable)progress |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id __nullable responseObject, NSError * __nullable error))completionHandler; |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; |
| | | |
| | | /** |
| | | Creates an `NSURLSessionUploadTask` with the specified streaming request. |
| | | |
| | | @param request The HTTP request for the request. |
| | | @param progress A progress object monitoring the current upload progress. |
| | | @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. |
| | | */ |
| | | - (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request |
| | | progress:(NSProgress * __nullable __autoreleasing * __nullable)progress |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id __nullable responseObject, NSError * __nullable error))completionHandler; |
| | | progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; |
| | | |
| | | ///----------------------------- |
| | | /// @name Running Download Tasks |
| | |
| | | Creates an `NSURLSessionDownloadTask` with the specified request. |
| | | |
| | | @param request The HTTP request for the request. |
| | | @param progress A progress object monitoring the current download progress. |
| | | @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. |
| | | @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. |
| | | |
| | | @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method. |
| | | */ |
| | | - (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request |
| | | progress:(NSProgress * __nullable __autoreleasing * __nullable)progress |
| | | progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock |
| | | destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * __nullable filePath, NSError * __nullable error))completionHandler; |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; |
| | | |
| | | /** |
| | | Creates an `NSURLSessionDownloadTask` with the specified resume data. |
| | | |
| | | @param resumeData The data used to resume downloading. |
| | | @param progress A progress object monitoring the current download progress. |
| | | @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. |
| | | @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. |
| | | @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. |
| | | */ |
| | | - (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData |
| | | progress:(NSProgress * __nullable __autoreleasing * __nullable)progress |
| | | progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock |
| | | destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * __nullable filePath, NSError * __nullable error))completionHandler; |
| | | completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; |
| | | |
| | | ///--------------------------------- |
| | | /// @name Getting Progress for Tasks |
| | |
| | | /** |
| | | Returns the upload progress of the specified task. |
| | | |
| | | @param uploadTask The session upload task. Must not be `nil`. |
| | | @param task The session task. Must not be `nil`. |
| | | |
| | | @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable. |
| | | */ |
| | | - (nullable NSProgress *)uploadProgressForTask:(NSURLSessionUploadTask *)uploadTask; |
| | | - (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task; |
| | | |
| | | /** |
| | | Returns the download progress of the specified task. |
| | | |
| | | @param downloadTask The session download task. Must not be `nil`. |
| | | @param task The session task. Must not be `nil`. |
| | | |
| | | @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable. |
| | | */ |
| | | - (nullable NSProgress *)downloadProgressForTask:(NSURLSessionDownloadTask *)downloadTask; |
| | | - (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task; |
| | | |
| | | ///----------------------------------------- |
| | | /// @name Setting Session Delegate Callbacks |
| | |
| | | |
| | | @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. |
| | | */ |
| | | - (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __nullable __autoreleasing * __nullable credential))block; |
| | | - (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; |
| | | |
| | | ///-------------------------------------- |
| | | /// @name Setting Task Delegate Callbacks |
| | |
| | | |
| | | @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response. |
| | | */ |
| | | - (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; |
| | | - (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * _Nullable (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; |
| | | |
| | | /** |
| | | Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`. |
| | | |
| | | @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. |
| | | */ |
| | | - (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __nullable __autoreleasing * __nullable credential))block; |
| | | - (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; |
| | | |
| | | /** |
| | | Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`. |
| | |
| | | |
| | | @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task. |
| | | */ |
| | | - (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * __nullable error))block; |
| | | - (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block; |
| | | |
| | | /** |
| | | Sets a block to be executed when metrics are finalized related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didFinishCollectingMetrics:`. |
| | | |
| | | @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any metrics that were collected in the process of executing the task. |
| | | */ |
| | | #if AF_CAN_INCLUDE_SESSION_TASK_METRICS |
| | | - (void)setTaskDidFinishCollectingMetricsBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * _Nullable metrics))block; |
| | | #endif |
| | | ///------------------------------------------- |
| | | /// @name Setting Data Task Delegate Callbacks |
| | | ///------------------------------------------- |
| | |
| | | |
| | | @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session. |
| | | */ |
| | | - (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block; |
| | | - (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block AF_API_UNAVAILABLE(macos); |
| | | |
| | | ///----------------------------------------------- |
| | | /// @name Setting Download Task Delegate Callbacks |
| | |
| | | |
| | | @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:`. |
| | |
| | | |
| | | @end |
| | | |
| | | #endif |
| | | |
| | | ///-------------------- |
| | | /// @name Notifications |
| | | ///-------------------- |
| | | |
| | | /** |
| | | Posted when a task begins executing. |
| | | |
| | | @deprecated Use `AFNetworkingTaskDidResumeNotification` instead. |
| | | */ |
| | | extern NSString * const AFNetworkingTaskDidStartNotification DEPRECATED_ATTRIBUTE; |
| | | |
| | | /** |
| | | Posted when a task resumes. |
| | | */ |
| | | extern 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 AFNetworkingTaskDidResumeNotification; |
| | | |
| | | /** |
| | | 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. |
| | | The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task. |
| | | */ |
| | | extern NSString * const AFNetworkingTaskDidFinishResponseDataKey DEPRECATED_ATTRIBUTE; |
| | | FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey; |
| | | |
| | | /** |
| | | The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if response data exists for the task. |
| | | The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized. |
| | | */ |
| | | extern NSString * const AFNetworkingTaskDidCompleteResponseDataKey; |
| | | FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey; |
| | | |
| | | /** |
| | | The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the response was serialized. |
| | | |
| | | @deprecated Use `AFNetworkingTaskDidCompleteSerializedResponseKey` instead. |
| | | The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer. |
| | | */ |
| | | extern NSString * const AFNetworkingTaskDidFinishSerializedResponseKey DEPRECATED_ATTRIBUTE; |
| | | FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey; |
| | | |
| | | /** |
| | | The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the response was serialized. |
| | | The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk. |
| | | */ |
| | | extern NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey; |
| | | FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey; |
| | | |
| | | /** |
| | | 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. |
| | | Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists. |
| | | */ |
| | | extern NSString * const AFNetworkingTaskDidFinishResponseSerializerKey DEPRECATED_ATTRIBUTE; |
| | | FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey; |
| | | |
| | | /** |
| | | The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the task has an associated response serializer. |
| | | The session task metrics taken from the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteSessionTaskMetrics` |
| | | */ |
| | | extern 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; |
| | | |
| | | /** |
| | | 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; |
| | | |
| | | /** |
| | | 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; |
| | | |
| | | /** |
| | | 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 AFNetworkingTaskDidCompleteSessionTaskMetrics; |
| | | |
| | | NS_ASSUME_NONNULL_END |
old mode 100755
new mode 100644
| | |
| | | // UIActivityIndicatorView+AFNetworking.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | @class AFURLConnectionOperation; |
| | | |
| | | /** |
| | | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a request operation or session task. |
| | | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task. |
| | | */ |
| | | @interface UIActivityIndicatorView (AFNetworking) |
| | | |
| | |
| | | |
| | | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. |
| | | */ |
| | | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 |
| | | - (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task; |
| | | #endif |
| | | |
| | | ///--------------------------------------- |
| | | /// @name Animating for Request Operations |
| | | ///--------------------------------------- |
| | | |
| | | /** |
| | | Binds the animating state to the execution state of the specified operation. |
| | | |
| | | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. |
| | | */ |
| | | - (void)setAnimatingWithStateOfOperation:(nullable AFURLConnectionOperation *)operation; |
| | | |
| | | @end |
| | | |
old mode 100755
new mode 100644
| | |
| | | // UIButton+AFNetworking.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | @protocol AFURLResponseSerialization, AFImageCache; |
| | | @class AFImageDownloader; |
| | | |
| | | /** |
| | | This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL. |
| | |
| | | */ |
| | | @interface UIButton (AFNetworking) |
| | | |
| | | ///---------------------------- |
| | | /// @name Accessing Image Cache |
| | | ///---------------------------- |
| | | |
| | | /** |
| | | The image cache used to improve image loading performance on scroll views. By default, `UIButton` will use the `sharedImageCache` of `UIImageView`. |
| | | */ |
| | | + (id <AFImageCache>)sharedImageCache; |
| | | |
| | | /** |
| | | Set the cache used for image loading. |
| | | |
| | | @param imageCache The image cache. |
| | | */ |
| | | + (void)setSharedImageCache:(__nullable id <AFImageCache>)imageCache; |
| | | |
| | | ///------------------------------------ |
| | | /// @name Accessing Response Serializer |
| | | /// @name Accessing the Image Downloader |
| | | ///------------------------------------ |
| | | |
| | | /** |
| | | The response serializer used to create an image representation from the server response and response data. By default, this is an instance of `AFImageResponseSerializer`. |
| | | Set the shared image downloader used to download images. |
| | | |
| | | @discussion Subclasses of `AFImageResponseSerializer` could be used to perform post-processing, such as color correction, face detection, or other effects. See https://github.com/AFNetworking/AFCoreImageSerializer |
| | | @param imageDownloader The shared image downloader used to download images. |
| | | */ |
| | | + (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader; |
| | | |
| | | /** |
| | | The shared image downloader used to download images. |
| | | */ |
| | | @property (nonatomic, strong) id <AFURLResponseSerialization> imageResponseSerializer; |
| | | + (AFImageDownloader *)sharedImageDownloader; |
| | | |
| | | ///-------------------- |
| | | /// @name Setting Image |
| | |
| | | @param state The control state. |
| | | @param urlRequest The URL request used for the image request. |
| | | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. |
| | | @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes two arguments: the server response and the image. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes a single argument: the error that occurred. |
| | | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. |
| | | */ |
| | | - (void)setImageForState:(UIControlState)state |
| | | withURLRequest:(NSURLRequest *)urlRequest |
| | | placeholderImage:(nullable UIImage *)placeholderImage |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, UIImage *image))success |
| | | failure:(nullable void (^)(NSError *error))failure; |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success |
| | | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; |
| | | |
| | | |
| | | ///------------------------------- |
| | |
| | | @param state The control state. |
| | | @param urlRequest The URL request used for the image request. |
| | | @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. |
| | | @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes two arguments: the server response and the image. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes a single argument: the error that occurred. |
| | | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. |
| | | */ |
| | | - (void)setBackgroundImageForState:(UIControlState)state |
| | | withURLRequest:(NSURLRequest *)urlRequest |
| | | placeholderImage:(nullable UIImage *)placeholderImage |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, UIImage *image))success |
| | | failure:(nullable void (^)(NSError *error))failure; |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success |
| | | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; |
| | | |
| | | |
| | | ///------------------------------ |
| | |
| | | ///------------------------------ |
| | | |
| | | /** |
| | | Cancels any executing image operation for the specified control state of the receiver, if one exists. |
| | | Cancels any executing image task for the specified control state of the receiver, if one exists. |
| | | |
| | | @param state The control state. |
| | | */ |
| | | - (void)cancelImageRequestOperationForState:(UIControlState)state; |
| | | - (void)cancelImageDownloadTaskForState:(UIControlState)state; |
| | | |
| | | /** |
| | | Cancels any executing background image operation for the specified control state of the receiver, if one exists. |
| | | Cancels any executing background image task for the specified control state of the receiver, if one exists. |
| | | |
| | | @param state The control state. |
| | | */ |
| | | - (void)cancelBackgroundImageRequestOperationForState:(UIControlState)state; |
| | | - (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state; |
| | | |
| | | @end |
| | | |
File was renamed from frameworks/AFNetworking.framework/Headers/UIKit+AFNetworking.h |
| | |
| | | // UIKit+AFNetworking.h |
| | | // |
| | | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) |
| | | // UIImage+AFNetworking.h |
| | | // |
| | | // |
| | | // Created by Paulo Ferreira on 08/07/15. |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| | | // THE SOFTWARE. |
| | | |
| | | #if TARGET_OS_IOS |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | #ifndef _UIKIT_AFNETWORKING_ |
| | | #define _UIKIT_AFNETWORKING_ |
| | | @interface UIImage (AFNetworking) |
| | | |
| | | #import "AFNetworkActivityIndicatorManager.h" |
| | | + (UIImage *)safeImageWithData:(NSData *)data; |
| | | |
| | | #import "UIActivityIndicatorView+AFNetworking.h" |
| | | #import "UIAlertView+AFNetworking.h" |
| | | #import "UIButton+AFNetworking.h" |
| | | #import "UIImageView+AFNetworking.h" |
| | | #import "UIProgressView+AFNetworking.h" |
| | | #import "UIRefreshControl+AFNetworking.h" |
| | | #import "UIWebView+AFNetworking.h" |
| | | #endif /* _UIKIT_AFNETWORKING_ */ |
| | | @end |
| | | |
| | | #endif |
old mode 100755
new mode 100644
| | |
| | | // UIImageView+AFNetworking.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | @protocol AFURLResponseSerialization, AFImageCache; |
| | | @class AFImageDownloader; |
| | | |
| | | /** |
| | | This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. |
| | | */ |
| | | @interface UIImageView (AFNetworking) |
| | | |
| | | ///---------------------------- |
| | | /// @name Accessing Image Cache |
| | | ///---------------------------- |
| | | |
| | | /** |
| | | The image cache used to improve image loading performance on scroll views. By default, this is an `NSCache` subclass conforming to the `AFImageCache` protocol, which listens for notification warnings and evicts objects accordingly. |
| | | */ |
| | | + (id <AFImageCache>)sharedImageCache; |
| | | |
| | | /** |
| | | Set the cache used for image loading. |
| | | |
| | | @param imageCache The image cache. |
| | | */ |
| | | + (void)setSharedImageCache:(__nullable id <AFImageCache>)imageCache; |
| | | |
| | | ///------------------------------------ |
| | | /// @name Accessing Response Serializer |
| | | /// @name Accessing the Image Downloader |
| | | ///------------------------------------ |
| | | |
| | | /** |
| | | The response serializer used to create an image representation from the server response and response data. By default, this is an instance of `AFImageResponseSerializer`. |
| | | Set the shared image downloader used to download images. |
| | | |
| | | @discussion Subclasses of `AFImageResponseSerializer` could be used to perform post-processing, such as color correction, face detection, or other effects. See https://github.com/AFNetworking/AFCoreImageSerializer |
| | | @param imageDownloader The shared image downloader used to download images. |
| | | */ |
| | | @property (nonatomic, strong) id <AFURLResponseSerialization> imageResponseSerializer; |
| | | + (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader; |
| | | |
| | | /** |
| | | The shared image downloader used to download images. |
| | | */ |
| | | + (AFImageDownloader *)sharedImageDownloader; |
| | | |
| | | ///-------------------- |
| | | /// @name Setting Image |
| | |
| | | |
| | | @param urlRequest The URL request used for the image request. |
| | | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. |
| | | @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. |
| | | @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. |
| | | @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. |
| | | */ |
| | | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest |
| | | placeholderImage:(nullable UIImage *)placeholderImage |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, UIImage *image))success |
| | | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, NSError *error))failure; |
| | | success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success |
| | | failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; |
| | | |
| | | /** |
| | | Cancels any executing image operation for the receiver, if one exists. |
| | | */ |
| | | - (void)cancelImageRequestOperation; |
| | | - (void)cancelImageDownloadTask; |
| | | |
| | | @end |
| | | |
| | | #pragma mark - |
| | | |
| | | /** |
| | | The `AFImageCache` protocol is adopted by an object used to cache images loaded by the AFNetworking category on `UIImageView`. |
| | | */ |
| | | @protocol AFImageCache <NSObject> |
| | | |
| | | /** |
| | | Returns a cached image for the specified request, if available. |
| | | |
| | | @param request The image request. |
| | | |
| | | @return The cached image. |
| | | */ |
| | | - (nullable UIImage *)cachedImageForRequest:(NSURLRequest *)request; |
| | | |
| | | /** |
| | | Caches a particular image for the specified request. |
| | | |
| | | @param image The image to cache. |
| | | @param request The request to be used as a cache key. |
| | | */ |
| | | - (void)cacheImage:(UIImage *)image |
| | | forRequest:(NSURLRequest *)request; |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
old mode 100755
new mode 100644
| | |
| | | // UIProgressView+AFNetworking.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS || TARGET_OS_TV |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | @class AFURLConnectionOperation; |
| | | |
| | | /** |
| | | This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task or request operation. |
| | | This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task. |
| | | */ |
| | | @interface UIProgressView (AFNetworking) |
| | | |
| | |
| | | @param task The session task. |
| | | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. |
| | | */ |
| | | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 |
| | | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task |
| | | animated:(BOOL)animated; |
| | | #endif |
| | | |
| | | /** |
| | | Binds the progress to the download progress of the specified session task. |
| | |
| | | @param task The session task. |
| | | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. |
| | | */ |
| | | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 |
| | | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task |
| | | animated:(BOOL)animated; |
| | | #endif |
| | | |
| | | ///------------------------------------ |
| | | /// @name Setting Session Task Progress |
| | | ///------------------------------------ |
| | | |
| | | /** |
| | | Binds the progress to the upload progress of the specified request operation. |
| | | |
| | | @param operation The request operation. |
| | | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. |
| | | */ |
| | | - (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation |
| | | animated:(BOOL)animated; |
| | | |
| | | /** |
| | | Binds the progress to the download progress of the specified request operation. |
| | | |
| | | @param operation The request operation. |
| | | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. |
| | | */ |
| | | - (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation |
| | | animated:(BOOL)animated; |
| | | |
| | | @end |
| | | |
old mode 100755
new mode 100644
| | |
| | | // UIRefreshControl+AFNetworking.m |
| | | // |
| | | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | @class AFURLConnectionOperation; |
| | | |
| | | /** |
| | | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a request operation or session task. |
| | | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task. |
| | | */ |
| | | @interface UIRefreshControl (AFNetworking) |
| | | |
| | |
| | | |
| | | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. |
| | | */ |
| | | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 |
| | | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; |
| | | #endif |
| | | |
| | | ///---------------------------------------- |
| | | /// @name Refreshing for Request Operations |
| | | ///---------------------------------------- |
| | | |
| | | /** |
| | | Binds the refreshing state to the execution state of the specified operation. |
| | | |
| | | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. |
| | | */ |
| | | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation; |
| | | |
| | | @end |
| | | |
old mode 100755
new mode 100644
| | |
| | | // UIWebView+AFNetworking.h |
| | | // Copyright (c) 2011–2015 Alamofire Software Foundation (http://alamofire.org/) |
| | | // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) |
| | | // |
| | | // Permission is hereby granted, free of charge, to any person obtaining a copy |
| | | // of this software and associated documentation files (the "Software"), to deal |
| | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | #import <Availability.h> |
| | | #import <TargetConditionals.h> |
| | | |
| | | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) |
| | | #if TARGET_OS_IOS |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | |
| | | @class AFHTTPRequestSerializer, AFHTTPResponseSerializer; |
| | | @protocol AFURLRequestSerialization, AFURLResponseSerialization; |
| | | @class AFHTTPSessionManager; |
| | | |
| | | /** |
| | | This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. |
| | |
| | | @interface UIWebView (AFNetworking) |
| | | |
| | | /** |
| | | The request serializer used to serialize requests made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPRequestSerializer`. |
| | | The session manager used to download all requests. |
| | | */ |
| | | @property (nonatomic, strong) AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer; |
| | | |
| | | /** |
| | | The response serializer used to serialize responses made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPResponseSerializer`. |
| | | */ |
| | | @property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer; |
| | | @property (nonatomic, strong) AFHTTPSessionManager *sessionManager; |
| | | |
| | | /** |
| | | Asynchronously loads the specified request. |
| | | |
| | | @param request A URL request identifying the location of the content to load. This must not be `nil`. |
| | | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. |
| | | @param progress A progress object monitoring the current download progress. |
| | | @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string. |
| | | @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 a single argument: the error that occurred. |
| | | @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. |
| | | */ |
| | | - (void)loadRequest:(NSURLRequest *)request |
| | | progress:(nullable void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress |
| | | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress |
| | | success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success |
| | | failure:(nullable void (^)(NSError *error))failure; |
| | | |
| | |
| | | @param request A URL request identifying the location of the content to load. This must not be `nil`. |
| | | @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. |
| | | @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. |
| | | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. |
| | | @param progress A progress object monitoring the current download progress. |
| | | @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data. |
| | | @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 a single argument: the error that occurred. |
| | | @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. |
| | | */ |
| | | - (void)loadRequest:(NSURLRequest *)request |
| | | MIMEType:(nullable NSString *)MIMEType |
| | | textEncodingName:(nullable NSString *)textEncodingName |
| | | progress:(nullable void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress |
| | | progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress |
| | | success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success |
| | | failure:(nullable void (^)(NSError *error))failure; |
| | | |
New file |
| | |
| | | framework module AFNetworking { |
| | | umbrella header "AFNetworking.h" |
| | | export * |
| | | module * { export * } |
| | | } |
| | |
| | | extern NSString *const WASDK_PARAM_KEY_SDK_VER; |
| | | extern NSString *const WASDK_PARAM_KEY_SDK_TYPE; |
| | | extern NSString *const WASDK_PARAM_KEY_RUN_PLATFORM; |
| | | extern NSString *const WASDK_PARAM_KEY_GAME_PLATFORM; |
| | | extern NSString *const WASDK_PARAM_KEY_REQUEST_FROM; |
| | | extern NSString *const WASDK_PARAM_KEY_SDK_ID; |
| | | extern NSString *const WASDK_PARAM_KEY_PATCH_ID; |
| | | extern NSString *const WASDK_PARAM_KEY_PATCH_VER; |
| | |
| | | extern NSString *const WASDK_PARAM_KEY_DEVICE_BRAND; |
| | | extern NSString *const WASDK_PARAM_KEY_DEVICE_NAME; |
| | | extern NSString *const WASDK_PARAM_KEY_PAGE_NO; |
| | | extern NSString *const WASDK_PARAM_KEY_PAGE; |
| | | extern NSString *const WASDK_PARAM_KEY_PAGE_SIZE; |
| | | extern NSString *const WASDK_PARAM_KEY_CHANNEL; |
| | | extern NSString *const WASDK_PARAM_KEY_BIND_TYPE; |
| | |
| | | extern NSString *const WASDK_AD_URL_SUBMIT_SHOW_EVENT; |
| | | // 更新展示广告状态 |
| | | extern NSString *const WASDK_AD_URL_UPDATE_STATUS; |
| | | // 充值中心-账号生成 |
| | | extern NSString *const WASDK_AD_URL_GAME_CREATE_WINGA_ACCOUNT; |
| | | |
| | | extern NSString *const WASDK_FB_INVITE_FROM_USERID; |
| | | extern NSString *const WASDK_FB_INVITE_TO_USERID; |
| | |
| | | #import <WACommon/WAWebProgressView.h> |
| | | #import <WACommon/WAWebViewController.h> |
| | | |
| | | //time:2018/10/26 10:38 |
| | | //time:2019/10/09 09:16 ver:1.3.0 |
| | | |
| | |
| | | |
| | | // In this header, you should import all the public headers of your framework using statements like #import <WASdkImpl/PublicHeader.h> |
| | | |
| | | //time:2018/10/26 10:38 ver:1.2.1 |
| | | //time:2019/10/10 09:16 ver:1.3.0 |