ashen_23

sdk upgrade

Showing 40 changed files with 6 additions and 2740 deletions
1 Pod::Spec.new do |s| 1 Pod::Spec.new do |s|
2 s.name = "HHVDoctorSDK" 2 s.name = "HHVDoctorSDK"
3 - s.version = "2.0.6.0819.1927" 3 + s.version = "2.0.6.0820.0952"
4 s.summary = "和缓视频医生 SDK" 4 s.summary = "和缓视频医生 SDK"
5 5
6 s.description = <<-DESC 6 s.description = <<-DESC
@@ -3,5 +3,5 @@ @@ -3,5 +3,5 @@
3 <plist version="1.0"> 3 <plist version="1.0">
4 <dict> 4 <dict>
5 <key>HHBundleVersion</key> 5 <key>HHBundleVersion</key>
6 -<string>08:19:19:27</string></dict> 6 +<string>08:20:09:52</string></dict>
7 </plist> 7 </plist>
1 -// HHCompatibilityMacros.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -#ifndef HHCompatibilityMacros_h  
23 -#define HHCompatibilityMacros_h  
24 -  
25 -#ifdef API_UNAVAILABLE  
26 - #define HH_API_UNAVAILABLE(x) API_UNAVAILABLE(x)  
27 -#else  
28 - #define HH_API_UNAVAILABLE(x)  
29 -#endif // API_UNAVAILABLE  
30 -  
31 -#if __has_warning("-Wunguarded-availability-new")  
32 - #define HH_CAN_USE_AT_AVAILABLE 1  
33 -#else  
34 - #define HH_CAN_USE_AT_AVAILABLE 0  
35 -#endif  
36 -  
37 -#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))  
38 - #define HH_CAN_INCLUDE_SESSION_TASK_METRICS 0  
39 -#else  
40 - #define HH_CAN_INCLUDE_SESSION_TASK_METRICS 1  
41 -#endif  
42 -  
43 -#endif /* HHCompatibilityMacros_h */  
1 -// HHHTTPSessionManager.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -#import <Foundation/Foundation.h>  
23 -#if !TARGET_OS_WATCH  
24 -#import <SystemConfiguration/SystemConfiguration.h>  
25 -#endif  
26 -#import <TargetConditionals.h>  
27 -  
28 -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV  
29 -#import <MobileCoreServices/MobileCoreServices.h>  
30 -#else  
31 -#import <CoreServices/CoreServices.h>  
32 -#endif  
33 -  
34 -#import "HHURLSessionManager.h"  
35 -  
36 -/**  
37 - `HHHTTPSessionManager` is a subclass of `HHURLSessionManager` 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.  
38 -  
39 - ## Subclassing Notes  
40 -  
41 - Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `HHHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.  
42 -  
43 - For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `HHHTTPRequestOperationManager` may be used to similar effect.  
44 -  
45 - ## Methods to Override  
46 -  
47 - 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:`.  
48 -  
49 - ## Serialization  
50 -  
51 - Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to `<HHURLRequestSerialization>`.  
52 -  
53 - Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `<HHURLResponseSerialization>`  
54 -  
55 - ## URL Construction Using Relative Paths  
56 -  
57 - For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`.  
58 -  
59 - Below are a few examples of how `baseURL` and relative paths interact:  
60 -  
61 - NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];  
62 - [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo  
63 - [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz  
64 - [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo  
65 - [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo  
66 - [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/  
67 - [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/  
68 -  
69 - Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.  
70 -  
71 - @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.  
72 - */  
73 -  
74 -NS_ASSUME_NONNULL_BEGIN  
75 -  
76 -@interface HHHTTPSessionManager : HHURLSessionManager <NSSecureCoding, NSCopying>  
77 -  
78 -/**  
79 - The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.  
80 - */  
81 -@property (readonly, nonatomic, strong, nullable) NSURL *baseURL;  
82 -  
83 -/**  
84 - Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `HHHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.  
85 -  
86 - @warning `requestSerializer` must not be `nil`.  
87 - */  
88 -@property (nonatomic, strong) HHHTTPRequestSerializer <HHURLRequestSerialization> * requestSerializer;  
89 -  
90 -/**  
91 - Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `HHJSONResponseSerializer`.  
92 -  
93 - @warning `responseSerializer` must not be `nil`.  
94 - */  
95 -@property (nonatomic, strong) HHHTTPResponseSerializer <HHURLResponseSerialization> * responseSerializer;  
96 -  
97 -///-------------------------------  
98 -/// @name Managing Security Policy  
99 -///-------------------------------  
100 -  
101 -/**  
102 - The security policy used by created session to evaluate server trust for secure connections. `HHURLSessionManager` uses the `defaultPolicy` unless otherwise specified. A security policy configured with `HHSSLPinningModePublicKey` or `HHSSLPinningModeCertificate` 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.  
103 - */  
104 -@property (nonatomic, strong) HHSecurityPolicy *securityPolicy;  
105 -  
106 -///---------------------  
107 -/// @name Initialization  
108 -///---------------------  
109 -  
110 -/**  
111 - Creates and returns an `HHHTTPSessionManager` object.  
112 - */  
113 -+ (instancetype)manager;  
114 -  
115 -/**  
116 - Initializes an `HHHTTPSessionManager` object with the specified base URL.  
117 -  
118 - @param url The base URL for the HTTP client.  
119 -  
120 - @return The newly-initialized HTTP client  
121 - */  
122 -- (instancetype)initWithBaseURL:(nullable NSURL *)url;  
123 -  
124 -/**  
125 - Initializes an `HHHTTPSessionManager` object with the specified base URL.  
126 -  
127 - This is the designated initializer.  
128 -  
129 - @param url The base URL for the HTTP client.  
130 - @param configuration The configuration used to create the managed session.  
131 -  
132 - @return The newly-initialized HTTP client  
133 - */  
134 -- (instancetype)initWithBaseURL:(nullable NSURL *)url  
135 - sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;  
136 -  
137 -///---------------------------  
138 -/// @name Making HTTP Requests  
139 -///---------------------------  
140 -  
141 -/**  
142 - Creates and runs an `NSURLSessionDataTask` with a `GET` request.  
143 -  
144 - @param URLString The URL string used to create the request URL.  
145 - @param parameters The parameters to be encoded according to the client request serializer.  
146 - @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.  
147 - @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.  
148 -  
149 - @see -dataTaskWithRequest:completionHandler:  
150 - */  
151 -- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString  
152 - parameters:(nullable id)parameters  
153 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
154 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
155 -  
156 -  
157 -/**  
158 - Creates and runs an `NSURLSessionDataTask` with a `GET` request.  
159 -  
160 - @param URLString The URL string used to create the request URL.  
161 - @param parameters The parameters to be encoded according to the client request serializer.  
162 - @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.  
163 - @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.  
164 - @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.  
165 -  
166 - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:  
167 - */  
168 -- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString  
169 - parameters:(nullable id)parameters  
170 - progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress  
171 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
172 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
173 -  
174 -/**  
175 - Creates and runs an `NSURLSessionDataTask` with a `GET` request.  
176 -  
177 - @param URLString The URL string used to create the request URL.  
178 - @param parameters The parameters to be encoded according to the client request serializer.  
179 - @param headers The headers appended to the default headers for this request.  
180 - @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.  
181 - @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.  
182 - @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.  
183 -  
184 - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:  
185 - */  
186 -- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString  
187 - parameters:(nullable id)parameters  
188 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
189 - progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress  
190 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
191 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
192 -  
193 -/**  
194 - Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.  
195 -  
196 - @param URLString The URL string used to create the request URL.  
197 - @param parameters The parameters to be encoded according to the client request serializer.  
198 - @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.  
199 - @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.  
200 -  
201 - @see -dataTaskWithRequest:completionHandler:  
202 - */  
203 -- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString  
204 - parameters:(nullable id)parameters  
205 - success:(nullable void (^)(NSURLSessionDataTask *task))success  
206 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
207 -  
208 -/**  
209 - Creates and runs an `NSURLSessionDataTask` with a `HEAD` request.  
210 -  
211 - @param URLString The URL string used to create the request URL.  
212 - @param parameters The parameters to be encoded according to the client request serializer.  
213 - @param headers The headers appended to the default headers for this request.  
214 - @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.  
215 - @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.  
216 -  
217 - @see -dataTaskWithRequest:completionHandler:  
218 - */  
219 -- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString  
220 - parameters:(nullable id)parameters  
221 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
222 - success:(nullable void (^)(NSURLSessionDataTask *task))success  
223 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
224 -  
225 -/**  
226 - Creates and runs an `NSURLSessionDataTask` with a `POST` request.  
227 -  
228 - @param URLString The URL string used to create the request URL.  
229 - @param parameters The parameters to be encoded according to the client request serializer.  
230 - @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.  
231 - @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.  
232 -  
233 - @see -dataTaskWithRequest:completionHandler:  
234 - */  
235 -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString  
236 - parameters:(nullable id)parameters  
237 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
238 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
239 -  
240 -/**  
241 - Creates and runs an `NSURLSessionDataTask` with a `POST` request.  
242 -  
243 - @param URLString The URL string used to create the request URL.  
244 - @param parameters The parameters to be encoded according to the client request serializer.  
245 - @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.  
246 - @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.  
247 - @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.  
248 -  
249 - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:  
250 - */  
251 -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString  
252 - parameters:(nullable id)parameters  
253 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress  
254 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
255 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
256 -  
257 -/**  
258 - Creates and runs an `NSURLSessionDataTask` with a `POST` request.  
259 -  
260 - @param URLString The URL string used to create the request URL.  
261 - @param parameters The parameters to be encoded according to the client request serializer.  
262 - @param headers The headers appended to the default headers for this request.  
263 - @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.  
264 - @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.  
265 - @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.  
266 -  
267 - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:  
268 - */  
269 -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString  
270 - parameters:(nullable id)parameters  
271 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
272 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress  
273 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
274 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
275 -  
276 -/**  
277 - Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.  
278 -  
279 - @param URLString The URL string used to create the request URL.  
280 - @param parameters The parameters to be encoded according to the client request serializer.  
281 - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `HHMultipartFormData` protocol.  
282 - @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.  
283 - @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.  
284 -  
285 - @see -dataTaskWithRequest:completionHandler:  
286 - */  
287 -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString  
288 - parameters:(nullable id)parameters  
289 - constructingBodyWithBlock:(nullable void (^)(id <HHMultipartFormData> formData))block  
290 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
291 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
292 -  
293 -/**  
294 - Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.  
295 -  
296 - @param URLString The URL string used to create the request URL.  
297 - @param parameters The parameters to be encoded according to the client request serializer.  
298 - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `HHMultipartFormData` protocol.  
299 - @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.  
300 - @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.  
301 - @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.  
302 -  
303 - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:  
304 - */  
305 -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString  
306 - parameters:(nullable id)parameters  
307 - constructingBodyWithBlock:(nullable void (^)(id <HHMultipartFormData> formData))block  
308 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress  
309 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
310 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
311 -/**  
312 - Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request.  
313 -  
314 - @param URLString The URL string used to create the request URL.  
315 - @param parameters The parameters to be encoded according to the client request serializer.  
316 - @param headers The headers appended to the default headers for this request.  
317 - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `HHMultipartFormData` protocol.  
318 - @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.  
319 - @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.  
320 - @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.  
321 -  
322 - @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:  
323 - */  
324 -- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString  
325 - parameters:(nullable id)parameters  
326 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
327 - constructingBodyWithBlock:(nullable void (^)(id <HHMultipartFormData> formData))block  
328 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress  
329 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
330 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
331 -  
332 -/**  
333 - Creates and runs an `NSURLSessionDataTask` with a `PUT` request.  
334 -  
335 - @param URLString The URL string used to create the request URL.  
336 - @param parameters The parameters to be encoded according to the client request serializer.  
337 - @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.  
338 - @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.  
339 -  
340 - @see -dataTaskWithRequest:completionHandler:  
341 - */  
342 -- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString  
343 - parameters:(nullable id)parameters  
344 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
345 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
346 -  
347 -/**  
348 - Creates and runs an `NSURLSessionDataTask` with a `PUT` request.  
349 -  
350 - @param URLString The URL string used to create the request URL.  
351 - @param parameters The parameters to be encoded according to the client request serializer.  
352 - @param headers The headers appended to the default headers for this request.  
353 - @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.  
354 - @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.  
355 -  
356 - @see -dataTaskWithRequest:completionHandler:  
357 - */  
358 -- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString  
359 - parameters:(nullable id)parameters  
360 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
361 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
362 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
363 -  
364 -/**  
365 - Creates and runs an `NSURLSessionDataTask` with a `PATCH` request.  
366 -  
367 - @param URLString The URL string used to create the request URL.  
368 - @param parameters The parameters to be encoded according to the client request serializer.  
369 - @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.  
370 - @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.  
371 -  
372 - @see -dataTaskWithRequest:completionHandler:  
373 - */  
374 -- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString  
375 - parameters:(nullable id)parameters  
376 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
377 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
378 -  
379 -/**  
380 - Creates and runs an `NSURLSessionDataTask` with a `PATCH` request.  
381 -  
382 - @param URLString The URL string used to create the request URL.  
383 - @param parameters The parameters to be encoded according to the client request serializer.  
384 - @param headers The headers appended to the default headers for this request.  
385 - @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.  
386 - @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.  
387 -  
388 - @see -dataTaskWithRequest:completionHandler:  
389 - */  
390 -- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString  
391 - parameters:(nullable id)parameters  
392 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
393 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
394 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
395 -  
396 -/**  
397 - Creates and runs an `NSURLSessionDataTask` with a `DELETE` request.  
398 -  
399 - @param URLString The URL string used to create the request URL.  
400 - @param parameters The parameters to be encoded according to the client request serializer.  
401 - @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.  
402 - @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.  
403 -  
404 - @see -dataTaskWithRequest:completionHandler:  
405 - */  
406 -- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString  
407 - parameters:(nullable id)parameters  
408 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
409 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE;  
410 -  
411 -/**  
412 - Creates and runs an `NSURLSessionDataTask` with a `DELETE` request.  
413 -  
414 - @param URLString The URL string used to create the request URL.  
415 - @param parameters The parameters to be encoded according to the client request serializer.  
416 - @param headers The headers appended to the default headers for this request.  
417 - @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.  
418 - @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.  
419 -  
420 - @see -dataTaskWithRequest:completionHandler:  
421 - */  
422 -- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString  
423 - parameters:(nullable id)parameters  
424 - headers:(nullable NSDictionary <NSString *, NSString *> *)headers  
425 - success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success  
426 - failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;  
427 -  
428 -@end  
429 -  
430 -NS_ASSUME_NONNULL_END  
1 -// HHNetworkReachabilityManager.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -#import <Foundation/Foundation.h>  
23 -  
24 -#if !TARGET_OS_WATCH  
25 -#import <SystemConfiguration/SystemConfiguration.h>  
26 -  
27 -typedef NS_ENUM(NSInteger, HHNetworkReachabilityStatus) {  
28 - HHNetworkReachabilityStatusUnknown = -1,  
29 - HHNetworkReachabilityStatusNotReachable = 0,  
30 - HHNetworkReachabilityStatusReachableViaWWAN = 1,  
31 - HHNetworkReachabilityStatusReachableViaWiFi = 2,  
32 -};  
33 -  
34 -NS_ASSUME_NONNULL_BEGIN  
35 -  
36 -/**  
37 - `HHNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.  
38 -  
39 - 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.  
40 -  
41 - See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )  
42 -  
43 - @warning Instances of `HHNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.  
44 - */  
45 -@interface HHNetworkReachabilityManager : NSObject  
46 -  
47 -/**  
48 - The current network reachability status.  
49 - */  
50 -@property (readonly, nonatomic, assign) HHNetworkReachabilityStatus networkReachabilityStatus;  
51 -  
52 -/**  
53 - Whether or not the network is currently reachable.  
54 - */  
55 -@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;  
56 -  
57 -/**  
58 - Whether or not the network is currently reachable via WWAN.  
59 - */  
60 -@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;  
61 -  
62 -/**  
63 - Whether or not the network is currently reachable via WiFi.  
64 - */  
65 -@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;  
66 -  
67 -///---------------------  
68 -/// @name Initialization  
69 -///---------------------  
70 -  
71 -/**  
72 - Returns the shared network reachability manager.  
73 - */  
74 -+ (instancetype)sharedManager;  
75 -  
76 -/**  
77 - Creates and returns a network reachability manager with the default socket address.  
78 -  
79 - @return An initialized network reachability manager, actively monitoring the default socket address.  
80 - */  
81 -+ (instancetype)manager;  
82 -  
83 -/**  
84 - Creates and returns a network reachability manager for the specified domain.  
85 -  
86 - @param domain The domain used to evaluate network reachability.  
87 -  
88 - @return An initialized network reachability manager, actively monitoring the specified domain.  
89 - */  
90 -+ (instancetype)managerForDomain:(NSString *)domain;  
91 -  
92 -/**  
93 - Creates and returns a network reachability manager for the socket address.  
94 -  
95 - @param address The socket address (`sockaddr_in6`) used to evaluate network reachability.  
96 -  
97 - @return An initialized network reachability manager, actively monitoring the specified socket address.  
98 - */  
99 -+ (instancetype)managerForAddress:(const void *)address;  
100 -  
101 -/**  
102 - Initializes an instance of a network reachability manager from the specified reachability object.  
103 -  
104 - @param reachability The reachability object to monitor.  
105 -  
106 - @return An initialized network reachability manager, actively monitoring the specified reachability.  
107 - */  
108 -- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;  
109 -  
110 -/**  
111 - * Unavailable initializer  
112 - */  
113 -+ (instancetype)new NS_UNAVAILABLE;  
114 -  
115 -/**  
116 - * Unavailable initializer  
117 - */  
118 -- (instancetype)init NS_UNAVAILABLE;  
119 -  
120 -///--------------------------------------------------  
121 -/// @name Starting & Stopping Reachability Monitoring  
122 -///--------------------------------------------------  
123 -  
124 -/**  
125 - Starts monitoring for changes in network reachability status.  
126 - */  
127 -- (void)startMonitoring;  
128 -  
129 -/**  
130 - Stops monitoring for changes in network reachability status.  
131 - */  
132 -- (void)stopMonitoring;  
133 -  
134 -///-------------------------------------------------  
135 -/// @name Getting Localized Reachability Description  
136 -///-------------------------------------------------  
137 -  
138 -/**  
139 - Returns a localized string representation of the current network reachability status.  
140 - */  
141 -- (NSString *)localizedNetworkReachabilityStatusString;  
142 -  
143 -///---------------------------------------------------  
144 -/// @name Setting Network Reachability Change Callback  
145 -///---------------------------------------------------  
146 -  
147 -/**  
148 - Sets a callback to be executed when the network availability of the `baseURL` host changes.  
149 -  
150 - @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.  
151 - */  
152 -- (void)setReachabilityStatusChangeBlock:(nullable void (^)(HHNetworkReachabilityStatus status))block;  
153 -  
154 -@end  
155 -  
156 -///----------------  
157 -/// @name Constants  
158 -///----------------  
159 -  
160 -/**  
161 - ## Network Reachability  
162 -  
163 - The following constants are provided by `HHNetworkReachabilityManager` as possible network reachability statuses.  
164 -  
165 - enum {  
166 - HHNetworkReachabilityStatusUnknown,  
167 - HHNetworkReachabilityStatusNotReachable,  
168 - HHNetworkReachabilityStatusReachableViaWWAN,  
169 - HHNetworkReachabilityStatusReachableViaWiFi,  
170 - }  
171 -  
172 - `HHNetworkReachabilityStatusUnknown`  
173 - The `baseURL` host reachability is not known.  
174 -  
175 - `HHNetworkReachabilityStatusNotReachable`  
176 - The `baseURL` host cannot be reached.  
177 -  
178 - `HHNetworkReachabilityStatusReachableViaWWAN`  
179 - The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.  
180 -  
181 - `HHNetworkReachabilityStatusReachableViaWiFi`  
182 - The `baseURL` host can be reached via a Wi-Fi connection.  
183 -  
184 - ### Keys for Notification UserInfo Dictionary  
185 -  
186 - Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.  
187 -  
188 - `HHNetworkingReachabilityNotificationStatusItem`  
189 - A key in the userInfo dictionary in a `HHNetworkingReachabilityDidChangeNotification` notification.  
190 - The corresponding value is an `NSNumber` object representing the `HHNetworkReachabilityStatus` value for the current reachability status.  
191 - */  
192 -  
193 -///--------------------  
194 -/// @name Notifications  
195 -///--------------------  
196 -  
197 -/**  
198 - Posted when network reachability changes.  
199 - This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `HHNetworkingReachabilityNotificationStatusItem` key, representing the `HHNetworkReachabilityStatus` value for the current network reachability.  
200 -  
201 - @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`).  
202 - */  
203 -FOUNDATION_EXPORT NSString * const HHNetworkingReachabilityDidChangeNotification;  
204 -FOUNDATION_EXPORT NSString * const HHNetworkingReachabilityNotificationStatusItem;  
205 -  
206 -///--------------------  
207 -/// @name Functions  
208 -///--------------------  
209 -  
210 -/**  
211 - Returns a localized string representation of an `HHNetworkReachabilityStatus` value.  
212 - */  
213 -FOUNDATION_EXPORT NSString * HHStringFromNetworkReachabilityStatus(HHNetworkReachabilityStatus status);  
214 -  
215 -NS_ASSUME_NONNULL_END  
216 -#endif  
1 -// HHNetworking.h  
2 -//  
3 -// Copyright (c) 2013 HHNetworking (http://HHnetworking.com/)  
4 -//  
5 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
6 -// of this software and associated documentation files (the "Software"), to deal  
7 -// in the Software without restriction, including without limitation the rights  
8 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
9 -// copies of the Software, and to permit persons to whom the Software is  
10 -// furnished to do so, subject to the following conditions:  
11 -//  
12 -// The above copyright notice and this permission notice shall be included in  
13 -// all copies or substantial portions of the Software.  
14 -//  
15 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
16 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
17 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
18 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
19 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
20 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
21 -// THE SOFTWARE.  
22 -  
23 -#import <Foundation/Foundation.h>  
24 -#import <Availability.h>  
25 -#import <TargetConditionals.h>  
26 -  
27 -#ifndef _HHNETWORKING_  
28 - #define _HHNETWORKING_  
29 -  
30 - #import "HHURLRequestSerialization.h"  
31 - #import "HHURLResponseSerialization.h"  
32 - #import "HHSecurityPolicy.h"  
33 -  
34 -#if !TARGET_OS_WATCH  
35 - #import "HHNetworkReachabilityManager.h"  
36 -#endif  
37 -  
38 - #import "HHURLSessionManager.h"  
39 - #import "HHHTTPSessionManager.h"  
40 -  
41 -#endif /* _HHNETWORKING_ */  
1 -// HHSecurityPolicy.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -#import <Foundation/Foundation.h>  
23 -#import <Security/Security.h>  
24 -  
25 -typedef NS_ENUM(NSUInteger, HHSSLPinningMode) {  
26 - HHSSLPinningModeNone,  
27 - HHSSLPinningModePublicKey,  
28 - HHSSLPinningModeCertificate,  
29 -};  
30 -  
31 -/**  
32 - `HHSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.  
33 -  
34 - Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.  
35 - */  
36 -  
37 -NS_ASSUME_NONNULL_BEGIN  
38 -  
39 -@interface HHSecurityPolicy : NSObject <NSSecureCoding, NSCopying>  
40 -  
41 -/**  
42 - The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `HHSSLPinningModeNone`.  
43 - */  
44 -@property (readonly, nonatomic, assign) HHSSLPinningMode SSLPinningMode;  
45 -  
46 -/**  
47 - The certificates used to evaluate server trust according to the SSL pinning mode.  
48 -  
49 - By default, this property is set to any (`.cer`) certificates included in the target compiling HHNetworking. Note that if you are using HHNetworking 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`.  
50 -  
51 - Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches.  
52 - */  
53 -@property (nonatomic, strong, nullable) NSSet <NSData *> *pinnedCertificates;  
54 -  
55 -/**  
56 - Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.  
57 - */  
58 -@property (nonatomic, assign) BOOL allowInvalidCertificates;  
59 -  
60 -/**  
61 - Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`.  
62 - */  
63 -@property (nonatomic, assign) BOOL validatesDomainName;  
64 -  
65 -///-----------------------------------------  
66 -/// @name Getting Certificates from the Bundle  
67 -///-----------------------------------------  
68 -  
69 -/**  
70 - Returns any certificates included in the bundle. If you are using HHNetworking 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`.  
71 -  
72 - @return The certificates included in the given bundle.  
73 - */  
74 -+ (NSSet <NSData *> *)certificatesInBundle:(NSBundle *)bundle;  
75 -  
76 -///-----------------------------------------  
77 -/// @name Getting Specific Security Policies  
78 -///-----------------------------------------  
79 -  
80 -/**  
81 - Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys.  
82 -  
83 - @return The default security policy.  
84 - */  
85 -+ (instancetype)defaultPolicy;  
86 -  
87 -///---------------------  
88 -/// @name Initialization  
89 -///---------------------  
90 -  
91 -/**  
92 - Creates and returns a security policy with the specified pinning mode.  
93 -  
94 - @param pinningMode The SSL pinning mode.  
95 -  
96 - @return A new security policy.  
97 - */  
98 -+ (instancetype)policyWithPinningMode:(HHSSLPinningMode)pinningMode;  
99 -  
100 -/**  
101 - Creates and returns a security policy with the specified pinning mode.  
102 -  
103 - @param pinningMode The SSL pinning mode.  
104 - @param pinnedCertificates The certificates to pin against.  
105 -  
106 - @return A new security policy.  
107 - */  
108 -+ (instancetype)policyWithPinningMode:(HHSSLPinningMode)pinningMode withPinnedCertificates:(NSSet <NSData *> *)pinnedCertificates;  
109 -  
110 -///------------------------------  
111 -/// @name Evaluating Server Trust  
112 -///------------------------------  
113 -  
114 -/**  
115 - Whether or not the specified server trust should be accepted, based on the security policy.  
116 -  
117 - This method should be used when responding to an authentication challenge from a server.  
118 -  
119 - @param serverTrust The X.509 certificate trust of the server.  
120 - @param domain The domain of serverTrust. If `nil`, the domain will not be validated.  
121 -  
122 - @return Whether or not to trust the server.  
123 - */  
124 -- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust  
125 - forDomain:(nullable NSString *)domain;  
126 -  
127 -@end  
128 -  
129 -NS_ASSUME_NONNULL_END  
130 -  
131 -///----------------  
132 -/// @name Constants  
133 -///----------------  
134 -  
135 -/**  
136 - ## SSL Pinning Modes  
137 -  
138 - The following constants are provided by `HHSSLPinningMode` as possible SSL pinning modes.  
139 -  
140 - enum {  
141 - HHSSLPinningModeNone,  
142 - HHSSLPinningModePublicKey,  
143 - HHSSLPinningModeCertificate,  
144 - }  
145 -  
146 - `HHSSLPinningModeNone`  
147 - Do not used pinned certificates to validate servers.  
148 -  
149 - `HHSSLPinningModePublicKey`  
150 - Validate host certificates against public keys of pinned certificates.  
151 -  
152 - `HHSSLPinningModeCertificate`  
153 - Validate host certificates against pinned certificates.  
154 -*/  
1 -// HHURLRequestSerialization.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -#import <Foundation/Foundation.h>  
23 -#import <TargetConditionals.h>  
24 -  
25 -#if TARGET_OS_IOS || TARGET_OS_TV  
26 -#import <UIKit/UIKit.h>  
27 -#elif TARGET_OS_WATCH  
28 -#import <WatchKit/WatchKit.h>  
29 -#endif  
30 -  
31 -NS_ASSUME_NONNULL_BEGIN  
32 -  
33 -/**  
34 - Returns a percent-escaped string following RFC 3986 for a query string key or value.  
35 - RFC 3986 states that the following characters are "reserved" characters.  
36 - - General Delimiters: ":", "#", "[", "]", "@", "?", "/"  
37 - - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "="  
38 -  
39 - In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow  
40 - query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"  
41 - should be percent-escaped in the query string.  
42 -  
43 - @param string The string to be percent-escaped.  
44 -  
45 - @return The percent-escaped string.  
46 - */  
47 -FOUNDATION_EXPORT NSString * HHPercentEscapedStringFromString(NSString *string);  
48 -  
49 -/**  
50 - A helper method to generate encoded url query parameters for appending to the end of a URL.  
51 -  
52 - @param parameters A dictionary of key/values to be encoded.  
53 -  
54 - @return A url encoded query string  
55 - */  
56 -FOUNDATION_EXPORT NSString * HHQueryStringFromParameters(NSDictionary *parameters);  
57 -  
58 -/**  
59 - The `HHURLRequestSerialization` 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.  
60 -  
61 - For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`.  
62 - */  
63 -@protocol HHURLRequestSerialization <NSObject, NSSecureCoding, NSCopying>  
64 -  
65 -/**  
66 - Returns a request with the specified parameters encoded into a copy of the original request.  
67 -  
68 - @param request The original request.  
69 - @param parameters The parameters to be encoded.  
70 - @param error The error that occurred while attempting to encode the request parameters.  
71 -  
72 - @return A serialized request.  
73 - */  
74 -- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request  
75 - withParameters:(nullable id)parameters  
76 - error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;  
77 -  
78 -@end  
79 -  
80 -#pragma mark -  
81 -  
82 -/**  
83 -  
84 - */  
85 -typedef NS_ENUM(NSUInteger, HHHTTPRequestQueryStringSerializationStyle) {  
86 - HHHTTPRequestQueryStringDefaultStyle = 0,  
87 -};  
88 -  
89 -@protocol HHMultipartFormData;  
90 -  
91 -/**  
92 - `HHHTTPRequestSerializer` conforms to the `HHURLRequestSerialization` & `HHURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.  
93 -  
94 - Any request or response serializer dealing with HTTP is encouraged to subclass `HHHTTPRequestSerializer` in order to ensure consistent default behavior.  
95 - */  
96 -@interface HHHTTPRequestSerializer : NSObject <HHURLRequestSerialization>  
97 -  
98 -/**  
99 - The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default.  
100 - */  
101 -@property (nonatomic, assign) NSStringEncoding stringEncoding;  
102 -  
103 -/**  
104 - Whether created requests can use the device’s cellular radio (if present). `YES` by default.  
105 -  
106 - @see NSMutableURLRequest -setAllowsCellularAccess:  
107 - */  
108 -@property (nonatomic, assign) BOOL allowsCellularAccess;  
109 -  
110 -/**  
111 - The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default.  
112 -  
113 - @see NSMutableURLRequest -setCachePolicy:  
114 - */  
115 -@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;  
116 -  
117 -/**  
118 - Whether created requests should use the default cookie handling. `YES` by default.  
119 -  
120 - @see NSMutableURLRequest -setHTTPShouldHandleCookies:  
121 - */  
122 -@property (nonatomic, assign) BOOL HTTPShouldHandleCookies;  
123 -  
124 -/**  
125 - Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default  
126 -  
127 - @see NSMutableURLRequest -setHTTPShouldUsePipelining:  
128 - */  
129 -@property (nonatomic, assign) BOOL HTTPShouldUsePipelining;  
130 -  
131 -/**  
132 - The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default.  
133 -  
134 - @see NSMutableURLRequest -setNetworkServiceType:  
135 - */  
136 -@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType;  
137 -  
138 -/**  
139 - The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds.  
140 -  
141 - @see NSMutableURLRequest -setTimeoutInterval:  
142 - */  
143 -@property (nonatomic, assign) NSTimeInterval timeoutInterval;  
144 -  
145 -///---------------------------------------  
146 -/// @name Configuring HTTP Request Headers  
147 -///---------------------------------------  
148 -  
149 -/**  
150 - Default HTTP header field values to be applied to serialized requests. By default, these include the following:  
151 -  
152 - - `Accept-Language` with the contents of `NSLocale +preferredLanguages`  
153 - - `User-Agent` with the contents of various bundle identifiers and OS designations  
154 -  
155 - @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`.  
156 - */  
157 -@property (readonly, nonatomic, strong) NSDictionary <NSString *, NSString *> *HTTPRequestHeaders;  
158 -  
159 -/**  
160 - Creates and returns a serializer with default configuration.  
161 - */  
162 -+ (instancetype)serializer;  
163 -  
164 -/**  
165 - Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header.  
166 -  
167 - @param field The HTTP header to set a default value for  
168 - @param value The value set as default for the specified header, or `nil`  
169 - */  
170 -- (void)setValue:(nullable NSString *)value  
171 -forHTTPHeaderField:(NSString *)field;  
172 -  
173 -/**  
174 - Returns the value for the HTTP headers set in the request serializer.  
175 -  
176 - @param field The HTTP header to retrieve the default value for  
177 -  
178 - @return The value set as default for the specified header, or `nil`  
179 - */  
180 -- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field;  
181 -  
182 -/**  
183 - Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header.  
184 -  
185 - @param username The HTTP basic auth username  
186 - @param password The HTTP basic auth password  
187 - */  
188 -- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username  
189 - password:(NSString *)password;  
190 -  
191 -/**  
192 - Clears any existing value for the "Authorization" HTTP header.  
193 - */  
194 -- (void)clearAuthorizationHeader;  
195 -  
196 -///-------------------------------------------------------  
197 -/// @name Configuring Query String Parameter Serialization  
198 -///-------------------------------------------------------  
199 -  
200 -/**  
201 - HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default.  
202 - */  
203 -@property (nonatomic, strong) NSSet <NSString *> *HTTPMethodsEncodingParametersInURI;  
204 -  
205 -/**  
206 - Set the method of query string serialization according to one of the pre-defined styles.  
207 -  
208 - @param style The serialization style.  
209 -  
210 - @see HHHTTPRequestQueryStringSerializationStyle  
211 - */  
212 -- (void)setQueryStringSerializationWithStyle:(HHHTTPRequestQueryStringSerializationStyle)style;  
213 -  
214 -/**  
215 - Set the a custom method of query string serialization according to the specified block.  
216 -  
217 - @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request.  
218 - */  
219 -- (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block;  
220 -  
221 -///-------------------------------  
222 -/// @name Creating Request Objects  
223 -///-------------------------------  
224 -  
225 -/**  
226 - Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string.  
227 -  
228 - 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.  
229 -  
230 - @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`.  
231 - @param URLString The URL string used to create the request URL.  
232 - @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body.  
233 - @param error The error that occurred while constructing the request.  
234 -  
235 - @return An `NSMutableURLRequest` object.  
236 - */  
237 -- (NSMutableURLRequest *)requestWithMethod:(NSString *)method  
238 - URLString:(NSString *)URLString  
239 - parameters:(nullable id)parameters  
240 - error:(NSError * _Nullable __autoreleasing *)error;  
241 -  
242 -/**  
243 - 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  
244 -  
245 - Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream.  
246 -  
247 - @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`.  
248 - @param URLString The URL string used to create the request URL.  
249 - @param parameters The parameters to be encoded and set in the request HTTP body.  
250 - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `HHMultipartFormData` protocol.  
251 - @param error The error that occurred while constructing the request.  
252 -  
253 - @return An `NSMutableURLRequest` object  
254 - */  
255 -- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method  
256 - URLString:(NSString *)URLString  
257 - parameters:(nullable NSDictionary <NSString *, id> *)parameters  
258 - constructingBodyWithBlock:(nullable void (^)(id <HHMultipartFormData> formData))block  
259 - error:(NSError * _Nullable __autoreleasing *)error;  
260 -  
261 -/**  
262 - 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.  
263 -  
264 - @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`.  
265 - @param fileURL The file URL to write multipart form contents to.  
266 - @param handler A handler block to execute.  
267 -  
268 - @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `HHURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request.  
269 -  
270 - @see https://github.com/HHNetworking/HHNetworking/issues/1398  
271 - */  
272 -- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request  
273 - writingStreamContentsToFile:(NSURL *)fileURL  
274 - completionHandler:(nullable void (^)(NSError * _Nullable error))handler;  
275 -  
276 -@end  
277 -  
278 -#pragma mark -  
279 -  
280 -/**  
281 - The `HHMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `HHHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`.  
282 - */  
283 -@protocol HHMultipartFormData  
284 -  
285 -/**  
286 - Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary.  
287 -  
288 - The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively.  
289 -  
290 - @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.  
291 - @param name The name to be associated with the specified data. This parameter must not be `nil`.  
292 - @param error If an error occurs, upon return contains an `NSError` object that describes the problem.  
293 -  
294 - @return `YES` if the file data was successfully appended, otherwise `NO`.  
295 - */  
296 -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL  
297 - name:(NSString *)name  
298 - error:(NSError * _Nullable __autoreleasing *)error;  
299 -  
300 -/**  
301 - 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.  
302 -  
303 - @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`.  
304 - @param name The name to be associated with the specified data. This parameter must not be `nil`.  
305 - @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`.  
306 - @param mimeType The declared MIME type of the file data. This parameter must not be `nil`.  
307 - @param error If an error occurs, upon return contains an `NSError` object that describes the problem.  
308 -  
309 - @return `YES` if the file data was successfully appended otherwise `NO`.  
310 - */  
311 -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL  
312 - name:(NSString *)name  
313 - fileName:(NSString *)fileName  
314 - mimeType:(NSString *)mimeType  
315 - error:(NSError * _Nullable __autoreleasing *)error;  
316 -  
317 -/**  
318 - 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.  
319 -  
320 - @param inputStream The input stream to be appended to the form data  
321 - @param name The name to be associated with the specified input stream. This parameter must not be `nil`.  
322 - @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`.  
323 - @param length The length of the specified input stream in bytes.  
324 - @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.  
325 - */  
326 -- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream  
327 - name:(NSString *)name  
328 - fileName:(NSString *)fileName  
329 - length:(int64_t)length  
330 - mimeType:(NSString *)mimeType;  
331 -  
332 -/**  
333 - 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.  
334 -  
335 - @param data The data to be encoded and appended to the form data.  
336 - @param name The name to be associated with the specified data. This parameter must not be `nil`.  
337 - @param fileName The filename to be associated with the specified data. This parameter must not be `nil`.  
338 - @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`.  
339 - */  
340 -- (void)appendPartWithFileData:(NSData *)data  
341 - name:(NSString *)name  
342 - fileName:(NSString *)fileName  
343 - mimeType:(NSString *)mimeType;  
344 -  
345 -/**  
346 - Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary.  
347 -  
348 - @param data The data to be encoded and appended to the form data.  
349 - @param name The name to be associated with the specified data. This parameter must not be `nil`.  
350 - */  
351 -  
352 -- (void)appendPartWithFormData:(NSData *)data  
353 - name:(NSString *)name;  
354 -  
355 -  
356 -/**  
357 - Appends HTTP headers, followed by the encoded data and the multipart form boundary.  
358 -  
359 - @param headers The HTTP headers to be appended to the form data.  
360 - @param body The data to be encoded and appended to the form data. This parameter must not be `nil`.  
361 - */  
362 -- (void)appendPartWithHeaders:(nullable NSDictionary <NSString *, NSString *> *)headers  
363 - body:(NSData *)body;  
364 -  
365 -/**  
366 - Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream.  
367 -  
368 - When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kHHUploadStream3GSuggestedPacketSize` and `kHHUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth.  
369 -  
370 - @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb.  
371 - @param delay Duration of delay each time a packet is read. By default, no delay is set.  
372 - */  
373 -- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes  
374 - delay:(NSTimeInterval)delay;  
375 -  
376 -@end  
377 -  
378 -#pragma mark -  
379 -  
380 -/**  
381 - `HHJSONRequestSerializer` is a subclass of `HHHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`.  
382 - */  
383 -@interface HHJSONRequestSerializer : HHHTTPRequestSerializer  
384 -  
385 -/**  
386 - Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default.  
387 - */  
388 -@property (nonatomic, assign) NSJSONWritingOptions writingOptions;  
389 -  
390 -/**  
391 - Creates and returns a JSON serializer with specified reading and writing options.  
392 -  
393 - @param writingOptions The specified JSON writing options.  
394 - */  
395 -+ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions;  
396 -  
397 -@end  
398 -  
399 -#pragma mark -  
400 -  
401 -/**  
402 - `HHPropertyListRequestSerializer` is a subclass of `HHHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`.  
403 - */  
404 -@interface HHPropertyListRequestSerializer : HHHTTPRequestSerializer  
405 -  
406 -/**  
407 - The property list format. Possible values are described in "NSPropertyListFormat".  
408 - */  
409 -@property (nonatomic, assign) NSPropertyListFormat format;  
410 -  
411 -/**  
412 - @warning The `writeOptions` property is currently unused.  
413 - */  
414 -@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions;  
415 -  
416 -/**  
417 - Creates and returns a property list serializer with a specified format, read options, and write options.  
418 -  
419 - @param format The property list format.  
420 - @param writeOptions The property list write options.  
421 -  
422 - @warning The `writeOptions` property is currently unused.  
423 - */  
424 -+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format  
425 - writeOptions:(NSPropertyListWriteOptions)writeOptions;  
426 -  
427 -@end  
428 -  
429 -#pragma mark -  
430 -  
431 -///----------------  
432 -/// @name Constants  
433 -///----------------  
434 -  
435 -/**  
436 - ## Error Domains  
437 -  
438 - The following error domain is predefined.  
439 -  
440 - - `NSString * const HHURLRequestSerializationErrorDomain`  
441 -  
442 - ### Constants  
443 -  
444 - `HHURLRequestSerializationErrorDomain`  
445 - HHURLRequestSerializer errors. Error codes for `HHURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.  
446 - */  
447 -FOUNDATION_EXPORT NSString * const HHURLRequestSerializationErrorDomain;  
448 -  
449 -/**  
450 - ## User info dictionary keys  
451 -  
452 - These keys may exist in the user info dictionary, in addition to those defined for NSError.  
453 -  
454 - - `NSString * const HHNetworkingOperationFailingURLRequestErrorKey`  
455 -  
456 - ### Constants  
457 -  
458 - `HHNetworkingOperationFailingURLRequestErrorKey`  
459 - The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `HHURLRequestSerializationErrorDomain`.  
460 - */  
461 -FOUNDATION_EXPORT NSString * const HHNetworkingOperationFailingURLRequestErrorKey;  
462 -  
463 -/**  
464 - ## Throttling Bandwidth for HTTP Request Input Streams  
465 -  
466 - @see -throttleBandwidthWithPacketSize:delay:  
467 -  
468 - ### Constants  
469 -  
470 - `kHHUploadStream3GSuggestedPacketSize`  
471 - Maximum packet size, in number of bytes. Equal to 16kb.  
472 -  
473 - `kHHUploadStream3GSuggestedDelay`  
474 - Duration of delay each time a packet is read. Equal to 0.2 seconds.  
475 - */  
476 -FOUNDATION_EXPORT NSUInteger const kHHUploadStream3GSuggestedPacketSize;  
477 -FOUNDATION_EXPORT NSTimeInterval const kHHUploadStream3GSuggestedDelay;  
478 -  
479 -NS_ASSUME_NONNULL_END  
1 -// HHURLResponseSerialization.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -#import <Foundation/Foundation.h>  
23 -#import <CoreGraphics/CoreGraphics.h>  
24 -  
25 -NS_ASSUME_NONNULL_BEGIN  
26 -  
27 -/**  
28 - Recursively removes `NSNull` values from a JSON object.  
29 -*/  
30 -id HHJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions);  
31 -  
32 -/**  
33 - The `HHURLResponseSerialization` 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.  
34 -  
35 - 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.  
36 - */  
37 -@protocol HHURLResponseSerialization <NSObject, NSSecureCoding, NSCopying>  
38 -  
39 -/**  
40 - The response object decoded from the data associated with a specified response.  
41 -  
42 - @param response The response to be processed.  
43 - @param data The response data to be decoded.  
44 - @param error The error that occurred while attempting to decode the response data.  
45 -  
46 - @return The object decoded from the specified response data.  
47 - */  
48 -- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response  
49 - data:(nullable NSData *)data  
50 - error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW;  
51 -  
52 -@end  
53 -  
54 -#pragma mark -  
55 -  
56 -/**  
57 - `HHHTTPResponseSerializer` conforms to the `HHURLRequestSerialization` & `HHURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.  
58 -  
59 - Any request or response serializer dealing with HTTP is encouraged to subclass `HHHTTPResponseSerializer` in order to ensure consistent default behavior.  
60 - */  
61 -@interface HHHTTPResponseSerializer : NSObject <HHURLResponseSerialization>  
62 -  
63 -- (instancetype)init;  
64 -  
65 -@property (nonatomic, assign) NSStringEncoding stringEncoding DEPRECATED_MSG_ATTRIBUTE("The string encoding is never used. HHHTTPResponseSerializer only validates status codes and content types but does not try to decode the received data in any way.");  
66 -  
67 -/**  
68 - Creates and returns a serializer with default configuration.  
69 - */  
70 -+ (instancetype)serializer;  
71 -  
72 -///-----------------------------------------  
73 -/// @name Configuring Response Serialization  
74 -///-----------------------------------------  
75 -  
76 -/**  
77 - The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation.  
78 -  
79 - See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html  
80 - */  
81 -@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;  
82 -  
83 -/**  
84 - 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.  
85 - */  
86 -@property (nonatomic, copy, nullable) NSSet <NSString *> *acceptableContentTypes;  
87 -  
88 -/**  
89 - Validates the specified response and data.  
90 -  
91 - In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks.  
92 -  
93 - @param response The response to be validated.  
94 - @param data The data associated with the response.  
95 - @param error The error that occurred while attempting to validate the response.  
96 -  
97 - @return `YES` if the response is valid, otherwise `NO`.  
98 - */  
99 -- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response  
100 - data:(nullable NSData *)data  
101 - error:(NSError * _Nullable __autoreleasing *)error;  
102 -  
103 -@end  
104 -  
105 -#pragma mark -  
106 -  
107 -  
108 -/**  
109 - `HHJSONResponseSerializer` is a subclass of `HHHTTPResponseSerializer` that validates and decodes JSON responses.  
110 -  
111 - By default, `HHJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types:  
112 -  
113 - - `application/json`  
114 - - `text/json`  
115 - - `text/javascript`  
116 -  
117 - 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.  
118 - */  
119 -@interface HHJSONResponseSerializer : HHHTTPResponseSerializer  
120 -  
121 -- (instancetype)init;  
122 -  
123 -/**  
124 - Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default.  
125 - */  
126 -@property (nonatomic, assign) NSJSONReadingOptions readingOptions;  
127 -  
128 -/**  
129 - Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`.  
130 - */  
131 -@property (nonatomic, assign) BOOL removesKeysWithNullValues;  
132 -  
133 -/**  
134 - Creates and returns a JSON serializer with specified reading and writing options.  
135 -  
136 - @param readingOptions The specified JSON reading options.  
137 - */  
138 -+ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions;  
139 -  
140 -@end  
141 -  
142 -#pragma mark -  
143 -  
144 -/**  
145 - `HHXMLParserResponseSerializer` is a subclass of `HHHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects.  
146 -  
147 - By default, `HHXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:  
148 -  
149 - - `application/xml`  
150 - - `text/xml`  
151 - */  
152 -@interface HHXMLParserResponseSerializer : HHHTTPResponseSerializer  
153 -  
154 -@end  
155 -  
156 -#pragma mark -  
157 -  
158 -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED  
159 -  
160 -/**  
161 - `HHXMLDocumentResponseSerializer` is a subclass of `HHHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.  
162 -  
163 - By default, `HHXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:  
164 -  
165 - - `application/xml`  
166 - - `text/xml`  
167 - */  
168 -@interface HHXMLDocumentResponseSerializer : HHHTTPResponseSerializer  
169 -  
170 -- (instancetype)init;  
171 -  
172 -/**  
173 - Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSXMLDocument` documentation section "Input and Output Options". `0` by default.  
174 - */  
175 -@property (nonatomic, assign) NSUInteger options;  
176 -  
177 -/**  
178 - Creates and returns an XML document serializer with the specified options.  
179 -  
180 - @param mask The XML document options.  
181 - */  
182 -+ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask;  
183 -  
184 -@end  
185 -  
186 -#endif  
187 -  
188 -#pragma mark -  
189 -  
190 -/**  
191 - `HHPropertyListResponseSerializer` is a subclass of `HHHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects.  
192 -  
193 - By default, `HHPropertyListResponseSerializer` accepts the following MIME types:  
194 -  
195 - - `application/x-plist`  
196 - */  
197 -@interface HHPropertyListResponseSerializer : HHHTTPResponseSerializer  
198 -  
199 -- (instancetype)init;  
200 -  
201 -/**  
202 - The property list format. Possible values are described in "NSPropertyListFormat".  
203 - */  
204 -@property (nonatomic, assign) NSPropertyListFormat format;  
205 -  
206 -/**  
207 - The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions."  
208 - */  
209 -@property (nonatomic, assign) NSPropertyListReadOptions readOptions;  
210 -  
211 -/**  
212 - Creates and returns a property list serializer with a specified format, read options, and write options.  
213 -  
214 - @param format The property list format.  
215 - @param readOptions The property list reading options.  
216 - */  
217 -+ (instancetype)serializerWithFormat:(NSPropertyListFormat)format  
218 - readOptions:(NSPropertyListReadOptions)readOptions;  
219 -  
220 -@end  
221 -  
222 -#pragma mark -  
223 -  
224 -/**  
225 - `HHImageResponseSerializer` is a subclass of `HHHTTPResponseSerializer` that validates and decodes image responses.  
226 -  
227 - By default, `HHImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:  
228 -  
229 - - `image/tiff`  
230 - - `image/jpeg`  
231 - - `image/gif`  
232 - - `image/png`  
233 - - `image/ico`  
234 - - `image/x-icon`  
235 - - `image/bmp`  
236 - - `image/x-bmp`  
237 - - `image/x-xbitmap`  
238 - - `image/x-win-bitmap`  
239 - */  
240 -@interface HHImageResponseSerializer : HHHTTPResponseSerializer  
241 -  
242 -#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH  
243 -/**  
244 - 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.  
245 - */  
246 -@property (nonatomic, assign) CGFloat imageScale;  
247 -  
248 -/**  
249 - Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default.  
250 - */  
251 -@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage;  
252 -#endif  
253 -  
254 -@end  
255 -  
256 -#pragma mark -  
257 -  
258 -/**  
259 - `HHCompoundSerializer` is a subclass of `HHHTTPResponseSerializer` that delegates the response serialization to the first `HHHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `HHHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer.  
260 - */  
261 -@interface HHCompoundResponseSerializer : HHHTTPResponseSerializer  
262 -  
263 -/**  
264 - The component response serializers.  
265 - */  
266 -@property (readonly, nonatomic, copy) NSArray <id<HHURLResponseSerialization>> *responseSerializers;  
267 -  
268 -/**  
269 - Creates and returns a compound serializer comprised of the specified response serializers.  
270 -  
271 - @warning Each response serializer specified must be a subclass of `HHHTTPResponseSerializer`, and response to `-validateResponse:data:error:`.  
272 - */  
273 -+ (instancetype)compoundSerializerWithResponseSerializers:(NSArray <id<HHURLResponseSerialization>> *)responseSerializers;  
274 -  
275 -@end  
276 -  
277 -///----------------  
278 -/// @name Constants  
279 -///----------------  
280 -  
281 -/**  
282 - ## Error Domains  
283 -  
284 - The following error domain is predefined.  
285 -  
286 - - `NSString * const HHURLResponseSerializationErrorDomain`  
287 -  
288 - ### Constants  
289 -  
290 - `HHURLResponseSerializationErrorDomain`  
291 - HHURLResponseSerializer errors. Error codes for `HHURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`.  
292 - */  
293 -FOUNDATION_EXPORT NSString * const HHURLResponseSerializationErrorDomain;  
294 -  
295 -/**  
296 - ## User info dictionary keys  
297 -  
298 - These keys may exist in the user info dictionary, in addition to those defined for NSError.  
299 -  
300 - - `NSString * const HHNetworkingOperationFailingURLResponseErrorKey`  
301 - - `NSString * const HHNetworkingOperationFailingURLResponseDataErrorKey`  
302 -  
303 - ### Constants  
304 -  
305 - `HHNetworkingOperationFailingURLResponseErrorKey`  
306 - The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `HHURLResponseSerializationErrorDomain`.  
307 -  
308 - `HHNetworkingOperationFailingURLResponseDataErrorKey`  
309 - The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `HHURLResponseSerializationErrorDomain`.  
310 - */  
311 -FOUNDATION_EXPORT NSString * const HHNetworkingOperationFailingURLResponseErrorKey;  
312 -  
313 -FOUNDATION_EXPORT NSString * const HHNetworkingOperationFailingURLResponseDataErrorKey;  
314 -  
315 -NS_ASSUME_NONNULL_END  
1 -// HHURLSessionManager.h  
2 -// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )  
3 -//  
4 -// Permission is hereby granted, free of charge, to any person obtaining a copy  
5 -// of this software and associated documentation files (the "Software"), to deal  
6 -// in the Software without restriction, including without limitation the rights  
7 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
8 -// copies of the Software, and to permit persons to whom the Software is  
9 -// furnished to do so, subject to the following conditions:  
10 -//  
11 -// The above copyright notice and this permission notice shall be included in  
12 -// all copies or substantial portions of the Software.  
13 -//  
14 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
15 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
16 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
17 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
18 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
19 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
20 -// THE SOFTWARE.  
21 -  
22 -  
23 -#import <Foundation/Foundation.h>  
24 -  
25 -#import "HHURLResponseSerialization.h"  
26 -#import "HHURLRequestSerialization.h"  
27 -#import "HHSecurityPolicy.h"  
28 -#import "HHCompatibilityMacros.h"  
29 -#if !TARGET_OS_WATCH  
30 -#import "HHNetworkReachabilityManager.h"  
31 -#endif  
32 -  
33 -/**  
34 - `HHURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to `<NSURLSessionTaskDelegate>`, `<NSURLSessionDataDelegate>`, `<NSURLSessionDownloadDelegate>`, and `<NSURLSessionDelegate>`.  
35 -  
36 - ## Subclassing Notes  
37 -  
38 - This is the base class for `HHHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `HHURLSessionManager` specifically for HTTP, consider subclassing `HHHTTPSessionManager` instead.  
39 -  
40 - ## NSURLSession & NSURLSessionTask Delegate Methods  
41 -  
42 - `HHURLSessionManager` implements the following delegate methods:  
43 -  
44 - ### `NSURLSessionDelegate`  
45 -  
46 - - `URLSession:didBecomeInvalidWithError:`  
47 - - `URLSession:didReceiveChallenge:completionHandler:`  
48 - - `URLSessionDidFinishEventsForBackgroundURLSession:`  
49 -  
50 - ### `NSURLSessionTaskDelegate`  
51 -  
52 - - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`  
53 - - `URLSession:task:didReceiveChallenge:completionHandler:`  
54 - - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`  
55 - - `URLSession:task:needNewBodyStream:`  
56 - - `URLSession:task:didCompleteWithError:`  
57 -  
58 - ### `NSURLSessionDataDelegate`  
59 -  
60 - - `URLSession:dataTask:didReceiveResponse:completionHandler:`  
61 - - `URLSession:dataTask:didBecomeDownloadTask:`  
62 - - `URLSession:dataTask:didReceiveData:`  
63 - - `URLSession:dataTask:willCacheResponse:completionHandler:`  
64 -  
65 - ### `NSURLSessionDownloadDelegate`  
66 -  
67 - - `URLSession:downloadTask:didFinishDownloadingToURL:`  
68 - - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`  
69 - - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`  
70 -  
71 - If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.  
72 -  
73 - ## Network Reachability Monitoring  
74 -  
75 - Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `HHNetworkReachabilityManager` for more details.  
76 -  
77 - ## NSCoding Caveats  
78 -  
79 - - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`.  
80 -  
81 - ## NSCopying Caveats  
82 -  
83 - - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original.  
84 - - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied.  
85 -  
86 - @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.  
87 - */  
88 -  
89 -NS_ASSUME_NONNULL_BEGIN  
90 -  
91 -@interface HHURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSSecureCoding, NSCopying>  
92 -  
93 -/**  
94 - The managed session.  
95 - */  
96 -@property (readonly, nonatomic, strong) NSURLSession *session;  
97 -  
98 -/**  
99 - The operation queue on which delegate callbacks are run.  
100 - */  
101 -@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;  
102 -  
103 -/**  
104 - Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `HHJSONResponseSerializer`.  
105 -  
106 - @warning `responseSerializer` must not be `nil`.  
107 - */  
108 -@property (nonatomic, strong) id <HHURLResponseSerialization> responseSerializer;  
109 -  
110 -///-------------------------------  
111 -/// @name Managing Security Policy  
112 -///-------------------------------  
113 -  
114 -/**  
115 - The security policy used by created session to evaluate server trust for secure connections. `HHURLSessionManager` uses the `defaultPolicy` unless otherwise specified.  
116 - */  
117 -@property (nonatomic, strong) HHSecurityPolicy *securityPolicy;  
118 -  
119 -#if !TARGET_OS_WATCH  
120 -///--------------------------------------  
121 -/// @name Monitoring Network Reachability  
122 -///--------------------------------------  
123 -  
124 -/**  
125 - The network reachability manager. `HHURLSessionManager` uses the `sharedManager` by default.  
126 - */  
127 -@property (readwrite, nonatomic, strong) HHNetworkReachabilityManager *reachabilityManager;  
128 -#endif  
129 -  
130 -///----------------------------  
131 -/// @name Getting Session Tasks  
132 -///----------------------------  
133 -  
134 -/**  
135 - The data, upload, and download tasks currently run by the managed session.  
136 - */  
137 -@property (readonly, nonatomic, strong) NSArray <NSURLSessionTask *> *tasks;  
138 -  
139 -/**  
140 - The data tasks currently run by the managed session.  
141 - */  
142 -@property (readonly, nonatomic, strong) NSArray <NSURLSessionDataTask *> *dataTasks;  
143 -  
144 -/**  
145 - The upload tasks currently run by the managed session.  
146 - */  
147 -@property (readonly, nonatomic, strong) NSArray <NSURLSessionUploadTask *> *uploadTasks;  
148 -  
149 -/**  
150 - The download tasks currently run by the managed session.  
151 - */  
152 -@property (readonly, nonatomic, strong) NSArray <NSURLSessionDownloadTask *> *downloadTasks;  
153 -  
154 -///-------------------------------  
155 -/// @name Managing Callback Queues  
156 -///-------------------------------  
157 -  
158 -/**  
159 - The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.  
160 - */  
161 -@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue;  
162 -  
163 -/**  
164 - The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.  
165 - */  
166 -@property (nonatomic, strong, nullable) dispatch_group_t completionGroup;  
167 -  
168 -///---------------------------------  
169 -/// @name Working Around System Bugs  
170 -///---------------------------------  
171 -  
172 -/**  
173 - Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default.  
174 -  
175 - @bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, HHNetworking will follow Apple's recommendation to try creating the task again.  
176 -  
177 - @see https://github.com/HHNetworking/HHNetworking/issues/1675  
178 - */  
179 -@property (nonatomic, assign) BOOL attemptsToRecreateUploadTasksForBackgroundSessions;  
180 -  
181 -///---------------------  
182 -/// @name Initialization  
183 -///---------------------  
184 -  
185 -/**  
186 - Creates and returns a manager for a session created with the specified configuration. This is the designated initializer.  
187 -  
188 - @param configuration The configuration used to create the managed session.  
189 -  
190 - @return A manager for a newly-created session.  
191 - */  
192 -- (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER;  
193 -  
194 -/**  
195 - Invalidates the managed session, optionally canceling pending tasks.  
196 -  
197 - @param cancelPendingTasks Whether or not to cancel pending tasks.  
198 - */  
199 -- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks DEPRECATED_ATTRIBUTE;  
200 -  
201 -/**  
202 - Invalidates the managed session, optionally canceling pending tasks and optionally resets given session.  
203 -  
204 - @param cancelPendingTasks Whether or not to cancel pending tasks.  
205 - @param resetSession Whether or not to reset the session of the manager.  
206 - */  
207 -- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks resetSession:(BOOL)resetSession;  
208 -  
209 -///-------------------------  
210 -/// @name Running Data Tasks  
211 -///-------------------------  
212 -  
213 -/**  
214 - Creates an `NSURLSessionDataTask` with the specified request.  
215 -  
216 - @param request The HTTP request for the request.  
217 - @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.  
218 - */  
219 -- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request  
220 - completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler DEPRECATED_ATTRIBUTE;  
221 -  
222 -/**  
223 - Creates an `NSURLSessionDataTask` with the specified request.  
224 -  
225 - @param request The HTTP request for the request.  
226 - @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.  
227 - @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.  
228 - @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.  
229 - */  
230 -- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request  
231 - uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock  
232 - downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock  
233 - completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;  
234 -  
235 -///---------------------------  
236 -/// @name Running Upload Tasks  
237 -///---------------------------  
238 -  
239 -/**  
240 - Creates an `NSURLSessionUploadTask` with the specified request for a local file.  
241 -  
242 - @param request The HTTP request for the request.  
243 - @param fileURL A URL to the local file to be uploaded.  
244 - @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.  
245 - @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.  
246 -  
247 - @see `attemptsToRecreateUploadTasksForBackgroundSessions`  
248 - */  
249 -- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request  
250 - fromFile:(NSURL *)fileURL  
251 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock  
252 - completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;  
253 -  
254 -/**  
255 - Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body.  
256 -  
257 - @param request The HTTP request for the request.  
258 - @param bodyData A data object containing the HTTP body to be uploaded.  
259 - @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.  
260 - @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.  
261 - */  
262 -- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request  
263 - fromData:(nullable NSData *)bodyData  
264 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock  
265 - completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;  
266 -  
267 -/**  
268 - Creates an `NSURLSessionUploadTask` with the specified streaming request.  
269 -  
270 - @param request The HTTP request for the request.  
271 - @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.  
272 - @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.  
273 - */  
274 -- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request  
275 - progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock  
276 - completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler;  
277 -  
278 -///-----------------------------  
279 -/// @name Running Download Tasks  
280 -///-----------------------------  
281 -  
282 -/**  
283 - Creates an `NSURLSessionDownloadTask` with the specified request.  
284 -  
285 - @param request The HTTP request for the request.  
286 - @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.  
287 - @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 HHter being moved to the returned URL.  
288 - @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.  
289 -  
290 - @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.  
291 - */  
292 -- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request  
293 - progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock  
294 - destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination  
295 - completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;  
296 -  
297 -/**  
298 - Creates an `NSURLSessionDownloadTask` with the specified resume data.  
299 -  
300 - @param resumeData The data used to resume downloading.  
301 - @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.  
302 - @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 HHter being moved to the returned URL.  
303 - @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.  
304 - */  
305 -- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData  
306 - progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock  
307 - destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination  
308 - completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler;  
309 -  
310 -///---------------------------------  
311 -/// @name Getting Progress for Tasks  
312 -///---------------------------------  
313 -  
314 -/**  
315 - Returns the upload progress of the specified task.  
316 -  
317 - @param task The session task. Must not be `nil`.  
318 -  
319 - @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable.  
320 - */  
321 -- (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task;  
322 -  
323 -/**  
324 - Returns the download progress of the specified task.  
325 -  
326 - @param task The session task. Must not be `nil`.  
327 -  
328 - @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable.  
329 - */  
330 -- (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task;  
331 -  
332 -///-----------------------------------------  
333 -/// @name Setting Session Delegate Callbacks  
334 -///-----------------------------------------  
335 -  
336 -/**  
337 - Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`.  
338 -  
339 - @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation.  
340 - */  
341 -- (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block;  
342 -  
343 -/**  
344 - Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`.  
345 -  
346 - @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.  
347 - */  
348 -- (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;  
349 -  
350 -///--------------------------------------  
351 -/// @name Setting Task Delegate Callbacks  
352 -///--------------------------------------  
353 -  
354 -/**  
355 - Sets a block to be executed when a task requires a new request body stream to send to the remote server, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:needNewBodyStream:`.  
356 -  
357 - @param block A block object to be executed when a task requires a new request body stream.  
358 - */  
359 -- (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block;  
360 -  
361 -/**  
362 - Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`.  
363 -  
364 - @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.  
365 - */  
366 -- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * _Nullable (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block;  
367 -  
368 -/**  
369 - 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:`.  
370 -  
371 - @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.  
372 - */  
373 -- (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block;  
374 -  
375 -/**  
376 - Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`.  
377 -  
378 - @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread.  
379 - */  
380 -- (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block;  
381 -  
382 -/**  
383 - Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`.  
384 -  
385 - @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.  
386 - */  
387 -- (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block;  
388 -  
389 -/**  
390 - Sets a block to be executed when metrics are finalized related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didFinishCollectingMetrics:`.  
391 -  
392 - @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.  
393 - */  
394 -#if HH_CAN_INCLUDE_SESSION_TASK_METRICS  
395 -- (void)setTaskDidFinishCollectingMetricsBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * _Nullable metrics))block;  
396 -#endif  
397 -///-------------------------------------------  
398 -/// @name Setting Data Task Delegate Callbacks  
399 -///-------------------------------------------  
400 -  
401 -/**  
402 - Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`.  
403 -  
404 - @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response.  
405 - */  
406 -- (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block;  
407 -  
408 -/**  
409 - Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`.  
410 -  
411 - @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become.  
412 - */  
413 -- (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block;  
414 -  
415 -/**  
416 - Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`.  
417 -  
418 - @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue.  
419 - */  
420 -- (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block;  
421 -  
422 -/**  
423 - Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`.  
424 -  
425 - @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response.  
426 - */  
427 -- (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block;  
428 -  
429 -/**  
430 - Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`.  
431 -  
432 - @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.  
433 - */  
434 -- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block HH_API_UNAVAILABLE(macos);  
435 -  
436 -///-----------------------------------------------  
437 -/// @name Setting Download Task Delegate Callbacks  
438 -///-----------------------------------------------  
439 -  
440 -/**  
441 - Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`.  
442 -  
443 - @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 `HHURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error.  
444 - */  
445 -- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block;  
446 -  
447 -/**  
448 - Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`.  
449 -  
450 - @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue.  
451 - */  
452 -- (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block;  
453 -  
454 -/**  
455 - Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`.  
456 -  
457 - @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded.  
458 - */  
459 -- (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block;  
460 -  
461 -@end  
462 -  
463 -///--------------------  
464 -/// @name Notifications  
465 -///--------------------  
466 -  
467 -/**  
468 - Posted when a task resumes.  
469 - */  
470 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidResumeNotification;  
471 -  
472 -/**  
473 - Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task.  
474 - */  
475 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteNotification;  
476 -  
477 -/**  
478 - Posted when a task suspends its execution.  
479 - */  
480 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidSuspendNotification;  
481 -  
482 -/**  
483 - Posted when a session is invalidated.  
484 - */  
485 -FOUNDATION_EXPORT NSString * const HHURLSessionDidInvalidateNotification;  
486 -  
487 -/**  
488 - Posted when a session download task encountered an error when moving the temporary download file to a specified destination.  
489 - */  
490 -FOUNDATION_EXPORT NSString * const HHURLSessionDownloadTaskDidFailToMoveFileNotification;  
491 -  
492 -/**  
493 - The raw response data of the task. Included in the userInfo dictionary of the `HHNetworkingTaskDidCompleteNotification` if response data exists for the task.  
494 - */  
495 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteResponseDataKey;  
496 -  
497 -/**  
498 - The serialized response object of the task. Included in the userInfo dictionary of the `HHNetworkingTaskDidCompleteNotification` if the response was serialized.  
499 - */  
500 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteSerializedResponseKey;  
501 -  
502 -/**  
503 - The response serializer used to serialize the response. Included in the userInfo dictionary of the `HHNetworkingTaskDidCompleteNotification` if the task has an associated response serializer.  
504 - */  
505 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteResponseSerializerKey;  
506 -  
507 -/**  
508 - The file path associated with the download task. Included in the userInfo dictionary of the `HHNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk.  
509 - */  
510 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteAssetPathKey;  
511 -  
512 -/**  
513 - Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `HHNetworkingTaskDidCompleteNotification` if an error exists.  
514 - */  
515 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteErrorKey;  
516 -  
517 -/**  
518 - The session task metrics taken from the download task. Included in the userInfo dictionary of the `HHNetworkingTaskDidCompleteSessionTaskMetrics`  
519 - */  
520 -FOUNDATION_EXPORT NSString * const HHNetworkingTaskDidCompleteSessionTaskMetrics;  
521 -  
522 -NS_ASSUME_NONNULL_END  
1 -//  
2 -// HttpsDNSAuth.h  
3 -// HHDoctorSDK  
4 -//  
5 -// Created by Shi Jian on 2018/8/9.  
6 -//  
7 -  
8 -#import <UIKit/UIKit.h>  
9 -  
10 -@interface HttpsDNSAuth : NSObject  
11 -  
12 -  
13 -//+ (void)sendRequest:(NSURLAuthenticationChallenge *)challenge request:(NSMutableURLRequest *)request;  
14 -  
15 -+ (void)requestHost:(NSString *)host didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *_Nullable))completionHandler;  
16 -  
17 -@end  
1 -//  
2 -// RTCRoom.h  
3 -// TXLiteAVDemo  
4 -//  
5 -// Created by lijie on 2017/10/30.  
6 -// Copyright © 2017年 Tencent. All rights reserved.  
7 -//  
8 -  
9 -#import <Foundation/Foundation.h>  
10 -#import <UIKit/UIKit.h>  
11 -#import "RoomDef.h"  
12 -  
13 -/**  
14 - 事件回调: 房间pusher列表下发、pusher进入、pusher退出、房间关闭、Debug事件信息、出错说明、接收群文本消息  
15 - */  
16 -@protocol RTCRoomListener <NSObject>  
17 -  
18 -- (void)onGetPusherList:(NSArray<PusherInfo *> *)pusherInfoArray;  
19 -  
20 -- (void)onPusherJoin:(PusherInfo *)pusherInfo;  
21 -  
22 -- (void)onPusherQuit:(PusherInfo *)pusherInfo;  
23 -  
24 -- (void)onRoomClose:(NSString *)roomID;  
25 -  
26 -- (void)onDebugMsg:(NSString *)msg;  
27 -  
28 -- (void)onError:(int)errCode errMsg:(NSString *)errMsg;  
29 -  
30 -@optional  
31 -- (void)onRecvRoomTextMsg:(NSString *)roomID userID:(NSString *)userID userName:(NSString *)userName userAvatar:(NSString *)userAvatar textMsg:(NSString *)textMsg;  
32 -  
33 -  
34 -- (void)onRecvCustomTextMsg:(NSString *)groupID userID:(NSString *)userID cmd:(NSString *)cmd userAvatar:(NSString *)userAvatar textMsg:(NSString *)textMsg;  
35 -@end  
36 -  
37 -  
38 -  
39 -/**  
40 - 初始化IM等功能的回调  
41 - @note: 初始化失败就不能创建和加入房间  
42 - */  
43 -typedef void (^ILoginCompletionHandler)(int errCode, NSString *errMsg);  
44 -  
45 -/**  
46 - 从RoomService后台登出回调  
47 - */  
48 -typedef void (^ILogoutCompletionHandler)(int errCode, NSString *errMsg);  
49 -  
50 -/**  
51 - 创建房间的回调  
52 - */  
53 -typedef void (^ICreateRoomCompletionHandler)(int errCode, NSString *errMsg);  
54 -  
55 -/**  
56 - 进入房间的回调  
57 - */  
58 -typedef void (^IEnterRoomCompletionHandler)(int errCode, NSString *errMsg);  
59 -  
60 -/**  
61 - 离开房间的回调  
62 - */  
63 -typedef void (^IExitRoomCompletionHandler)(int errCode, NSString *errMsg);  
64 -  
65 -/**  
66 - 获取房间列表的回调  
67 - @param roomInfoArray 请求的房间列表信息  
68 - */  
69 -typedef void (^IGetRoomListCompletionHandler)(int errCode, NSString *errMsg, NSArray<RoomInfo *> *roomInfoArray);  
70 -  
71 -/**  
72 - 播放开始的回调  
73 - */  
74 -typedef void (^IPlayBegin)();  
75 -  
76 -/**  
77 - 播放过程中发生错误时的回调  
78 - */  
79 -typedef void (^IPlayError)(int errCode, NSString *errMsg);  
80 -  
81 -  
82 -@interface RTCRoom : NSObject  
83 -  
84 -@property (nonatomic, weak) id<RTCRoomListener> delegate;  
85 -  
86 -/**  
87 - 初始化IM等功能,客户需要注册云通信账号,使用独立模式,IM签名信息及用户信息,客户在登录后台计算并通过登录协议返回  
88 - @param serverDomain 服务器域名地址  
89 - @param loginInfo 初始化信息  
90 - @param completion 初始化完成的回调  
91 -*/  
92 -- (void)login:(NSString*)serverDomain loginInfo:(LoginInfo *)loginInfo withCompletion:(ILoginCompletionHandler)completion;  
93 -  
94 -/**  
95 - 从Room后台登出  
96 - @param completion 登出完成回调  
97 - */  
98 --(void)logout:(ILogoutCompletionHandler)completion;  
99 -  
100 -/**  
101 - 创建房间  
102 - @param roomID 房间ID,可以传空  
103 - @param roomInfo 房间信息  
104 - @param completion 房间创建完成的回调,里面会携带roomID  
105 - */  
106 -- (void)createRoom:(NSString *)roomID roomInfo:(NSString *)roomInfo withCompletion:(ICreateRoomCompletionHandler)completion;  
107 -  
108 -/**  
109 - 进入房间  
110 - @param roomID 房间号  
111 - @param completion 进入房间完成的回调  
112 - */  
113 -- (void)enterRoom:(NSString *)roomID withCompletion:(IEnterRoomCompletionHandler)completion;  
114 -  
115 -/**  
116 - 离开房间  
117 - */  
118 -- (void)exitRoom:(IExitRoomCompletionHandler)completion;  
119 -  
120 -/**  
121 - 获取房间列表,分页获取  
122 - @param index 获取的房间开始索引,从0开始计算  
123 - @param cnt 获取的房间个数  
124 - @param completion 拉取房间列表完成的回调,回调里返回获取的房间列表信息,如果个数小于cnt则表示已经拉取所有的房间列表  
125 - */  
126 -- (void)getRoomList:(int)index cnt:(int)cnt withCompletion:(IGetRoomListCompletionHandler)completion;  
127 -  
128 -/**  
129 - 发送群文本消息  
130 - */  
131 -- (void)sendRoomTextMsg:(NSString *)textMsg;  
132 -  
133 -- (void)sendRoomCusMsg:(NSString *)textMsg cmd: (NSString *)cmd;  
134 -  
135 -/**  
136 - 预览本地画面  
137 - @param view 本地预览画面展示的区域  
138 - */  
139 -- (void)startLocalPreview:(UIView *)view;  
140 -  
141 -/**  
142 - 停止本地预览  
143 - */  
144 -- (void)stopLocalPreview;  
145 -  
146 -/**  
147 - 播放指定userID的视频  
148 - @param view 播放视频所在的区域  
149 - @userID 要播放的成员ID  
150 - @playBegin 播放开始的回调  
151 - @playError 播放过程中发生错误时的回调  
152 - */  
153 -- (void)addRemoteView:(UIView *)view withUserID:(NSString *)userID playBegin:(IPlayBegin)playBegin playError:(IPlayError)playError;  
154 -  
155 -/**  
156 - 停止播放指定userID的视频  
157 - @userID 停止播放的成员ID  
158 - @note 收到onPusherQuit事件后,内部会调用此函数停止播放该成员的视频,用户只需在UI层上层将对应的view销毁或者隐藏,改变显示布局  
159 - */  
160 -- (void)deleteRemoteView:(NSString *)userID;  
161 -  
162 -/**  
163 - 切换前后摄像头  
164 - */  
165 -- (void)switchCamera;  
166 -  
167 -/**  
168 - 设置静音推流  
169 - */  
170 -- (void)setMute:(BOOL)isMute;  
171 -  
172 -/**  
173 - 设置声音是否为高清晰度  
174 - @param isHD YES: 48K采样,NO: 16K采样  
175 - */  
176 -- (void)setHDAudio:(BOOL)isHD;  
177 -  
178 -/**  
179 - 设置视频的码率区间  
180 - @param minBitrate 最低码率  
181 - @param maxBitrate 最高码率  
182 - */  
183 -- (void)setBitrateRange:(int)minBitrate max:(int)maxBitrate;  
184 -  
185 -/**  
186 - 从前台切到后台后会发送静音数据,同时发送默认画面  
187 - @param pauseImage 要发送的默认画面图片  
188 - */  
189 -- (void)switchToBackground:(UIImage *)pauseImage;  
190 -  
191 -/**  
192 - 从后台回到前台的时候,调用此函数恢复推送camera采集的数据  
193 - */  
194 -- (void)switchToForeground;  
195 -  
196 -/**  
197 - 在渲染view上显示播放或推流状态统计及事件消息浮层  
198 - */  
199 -- (void)showVideoDebugLog:(BOOL)isShow;  
200 -  
201 -/**  
202 - 设置美颜 和 美白 效果级别  
203 - @praram beautyStyle 取值为TX_Enum_Type_BeautyStyle  
204 - @praram beautyLevel 美颜级别取值范围 0 ~ 9; 0 表示关闭 1 ~ 9值越大 效果越明显。  
205 - @praram whitenessLevel 美白级别取值范围 0 ~ 9; 0 表示关闭 1 ~ 9值越大 效果越明显。  
206 - @praram ruddinessLevel 红润级别取值范围 0 ~ 9; 0 表示关闭 1 ~ 9值越大 效果越明显。  
207 - */  
208 -- (void)setBeautyStyle:(int)beautyStyle beautyLevel:(float)beautyLevel whitenessLevel:(float)whitenessLevel ruddinessLevel:(float)ruddinessLevel;  
209 -  
210 --(void)resetRoom;  
211 -  
212 -/**  
213 - 切换到音频/视频模式  
214 -  
215 - @param isVoice 是否是音频模式  
216 - */  
217 -- (void)switch2voice:(Boolean)isVoice;  
218 -  
219 -/// 打开闪光灯  
220 -- (void)openFlash:(Boolean)open;  
221 -  
222 -  
223 -- (void)onPusherChanged;  
224 -  
225 -@end  
1 -//  
2 -// RoomDef.h  
3 -// TXLiteAVDemo  
4 -//  
5 -// Created by lijie on 2017/11/21.  
6 -// Copyright © 2017年 Tencent. All rights reserved.  
7 -//  
8 -  
9 -#import <Foundation/Foundation.h>  
10 -  
11 -// 初始化信息  
12 -@interface LoginInfo : NSObject  
13 -@property (nonatomic, assign) int sdkAppID;  
14 -@property (nonatomic, copy) NSString* userID;  
15 -@property (nonatomic, copy) NSString* userName;  
16 -@property (nonatomic, copy) NSString* userAvatar;  
17 -@property (nonatomic, copy) NSString* userSig;  
18 -@property (nonatomic, copy) NSString* accType;  
19 -@end  
20 -  
21 -// 用户账号信息  
22 -@interface SelfAccountInfo : NSObject  
23 -@property (nonatomic, copy) NSString* userID;  
24 -@property (nonatomic, copy) NSString* userSig;  
25 -@property (nonatomic, assign) int sdkAppID;  
26 -@property (nonatomic, copy) NSString* accType;  
27 -@property (nonatomic, copy) NSString* userName;  
28 -@property (nonatomic, copy) NSString* userAvatar;  
29 -@end  
30 -  
31 -// 推流者信息  
32 -@interface PusherInfo : NSObject  
33 -@property (nonatomic, copy) NSString* userID;  
34 -@property (nonatomic, copy) NSString* userName;  
35 -@property (nonatomic, copy) NSString* userAvatar;  
36 -@property (nonatomic, copy) NSString* playUrl;  
37 -@end  
38 -  
39 -// 普通观众信息(LiveRoom直播房间有普通观众,RTCRoom实时房间没有普通观众)  
40 -@interface AudienceInfo : NSObject  
41 -@property (nonatomic, copy) NSString* userID;  
42 -@property (nonatomic, copy) NSString* userInfo;  
43 -@end  
44 -  
45 -// 房间信息  
46 -@interface RoomInfo : NSObject  
47 -@property (nonatomic, copy) NSString* roomID;  
48 -@property (nonatomic, copy) NSString* roomInfo;  
49 -@property (nonatomic, copy) NSString* roomName;  
50 -@property (nonatomic, copy) NSString* roomCreator; // 房间创建者的userID  
51 -@property (nonatomic, copy) NSString* mixedPlayURL; // 房间混流播放地址  
52 -@property (nonatomic, strong) NSMutableArray<PusherInfo*>* pusherInfoArray;  
53 -@property (nonatomic, strong) NSMutableArray<AudienceInfo*>* audienceInfoArray;  
54 -@end  
55 -  
56 -  
57 -// 视频分辨率比例  
58 -typedef NS_ENUM(NSInteger, RoomVideoRatio) {  
59 - ROOM_VIDEO_RATIO_9_16 = 1, // 视频分辨率为9:16  
60 - ROOM_VIDEO_RATIO_3_4 = 2, // 视频分辨率为3:4  
61 - ROOM_VIDEO_RATIO_1_1 = 3, // 视频分辨率为1:1  
62 -};  
63 -  
64 -// 错误码列表  
65 -typedef NS_ENUM(NSInteger, RoomErrCode) {  
66 - ROOM_SUCCESS = 0, // 成功  
67 - ROOM_ERR_REQUEST_TIMEOUT = -1, // 请求超时  
68 - ROOM_ERR_IM_LOGIN = -2, // IM登录失败  
69 - ROOM_ERR_CREATE_ROOM = -3, // 创建房间失败  
70 - ROOM_ERR_ENTER_ROOM = -4, // 加入房间失败  
71 - ROOM_ERR_PUSH_DISCONNECT = -5, // 推流连接断开  
72 - ROOM_ERR_NET_ERROR = -6, // 网络错误  
73 -};  
1 -//  
2 -// RoomMsgMgr.h  
3 -// TXLiteAVDemo  
4 -//  
5 -// Created by lijie on 2017/11/1.  
6 -// Copyright © 2017年 Tencent. All rights reserved.  
7 -//  
8 -  
9 -#import <Foundation/Foundation.h>  
10 -  
11 -@interface RoomMsgMgrConfig : NSObject  
12 -@property (nonatomic, copy) NSString* userID; // 后台分配的唯一ID  
13 -@property (nonatomic, assign) int appID; // IM登录的appid  
14 -@property (nonatomic, copy) NSString* accType; // IM登录的账号类型  
15 -@property (nonatomic, copy) NSString* userSig; // IM登录需要的签名  
16 -@property (nonatomic, copy) NSString* userName; // 发送自定义文本消息时需要  
17 -@property (nonatomic, copy) NSString* userAvatar; // 发送自定义文本消息时需要  
18 -@end  
19 -  
20 -  
21 -@protocol RoomMsgListener <NSObject>  
22 -  
23 -// 接收群文本消息  
24 -- (void)onRecvGroupTextMsg:(NSString *)groupID userID:(NSString *)userID textMsg:(NSString *)textMsg userName:(NSString *)userName userAvatar:(NSString *)userAvatar;  
25 -  
26 -// 接收到群成员变更消息  
27 -- (void)onMemberChange:(NSString *)groupID;  
28 -  
29 -// 接收到房间解散消息  
30 -- (void)onGroupDelete:(NSString *)groupID;  
31 -  
32 -@optional  
33 -  
34 -// 接收到小主播的连麦请求  
35 -- (void)onRecvLinkMicRequest:(NSString *)groupID userID:(NSString *)userID userName:(NSString *)userName userAvatar:(NSString *)userAvatar;  
36 -  
37 -// 接收到大主播的连麦回应, result为YES表示同意连麦,为NO表示拒绝连麦  
38 -- (void)onRecvLinkMicResponse:(NSString *)groupID result:(BOOL)result message:(NSString *)message;  
39 -  
40 -// 接收到被大主播的踢出连麦的消息  
41 -- (void)onRecvLinkMicKickout:(NSString *)groupID;  
42 -  
43 -// 接收群自定义消息,cmd为自定义命令字,msg为自定义消息体(这里统一使用json字符串)  
44 -- (void)onRecvGroupCustomMsg:(NSString *)groupID userID:(NSString *)userID cmd:(NSString *)cmd msg:(NSString *)msg userName:(NSString *)userName userAvatar:(NSString *)userAvatar;  
45 -  
46 -  
47 -// 接收到PK请求  
48 -- (void)onRecvPKRequest:(NSString *)groupID userID:(NSString *)userID userName:(NSString *)userName userAvatar:(NSString *)userAvatar streamUrl:(NSString *)streamUrl;  
49 -  
50 -// 接收到PK请求回应, result为YES表示同意PK,为NO表示拒绝PK,若同意,则streamUrl为对方的播放流地址  
51 -- (void)onRecvPKResponse:(NSString *)groupID userID:(NSString *)userID result:(BOOL)result message:(NSString *)message streamUrl:(NSString *)streamUrl;  
52 -  
53 -// 接收PK结束消息  
54 -- (void)onRecvPKFinishRequest:(NSString *)groupID userID:(NSString *)userID;  
55 -  
56 -@end  
57 -  
58 -  
59 -typedef void (^IRoomMsgMgrCompletion)(int errCode, NSString *errMsg);  
60 -  
61 -  
62 -@interface RoomMsgMgr : NSObject  
63 -  
64 -@property (nonatomic, weak) id<RoomMsgListener> delegate;  
65 -  
66 -  
67 -- (instancetype)initWithConfig:(RoomMsgMgrConfig *)config;  
68 -  
69 -// 登录  
70 -- (void)login:(IRoomMsgMgrCompletion)completion;  
71 -  
72 -// 登出  
73 -- (void)logout:(IRoomMsgMgrCompletion)completion;  
74 -  
75 -// 创建房间  
76 -- (void)createRoom:(NSString *)groupID groupName:(NSString *)groupName completion:(IRoomMsgMgrCompletion)completion;  
77 -  
78 -// 加入房间  
79 -- (void)enterRoom:(NSString *)groupID completion:(IRoomMsgMgrCompletion)completion;  
80 -  
81 -// 退出房间  
82 -- (void)leaveRoom:(NSString *)groupID completion:(IRoomMsgMgrCompletion)completion;  
83 -  
84 -// 发送群自定义消息  
85 -- (void)sendRoomCustomMsg:(NSString *)cmd msg:(NSString *)msg;  
86 -  
87 -// 发送群文本消息  
88 -- (void)sendRoomTextMsg:(NSString *)textMsg;  
89 -  
90 -// 向userID发起连麦请求  
91 -- (void)sendLinkMicRequest:(NSString *)userID;  
92 -  
93 -// 向userID发起连麦响应, result为YES表示接收,为NO表示拒绝  
94 -- (void)sendLinkMicResponse:(NSString *)userID withResult:(BOOL)result andReason:(NSString *)reason;  
95 -  
96 -// 群主向userID发出踢出连麦消息  
97 -- (void)sendLinkMicKickout:(NSString *)userID;  
98 -  
99 -// 向userID发起PK请求  
100 -- (void)sendPKRequest:(NSString *)userID withAccelerateURL:(NSString *)accelerateURL;  
101 -  
102 -// 请求结束PK  
103 -- (void)sendPKFinishRequest:(NSString *)userID;  
104 -  
105 -// 接收PK  
106 -- (void)acceptPKRequest:(NSString *)userID withAccelerateURL:(NSString *)accelerateURL;  
107 -  
108 -// 拒绝PK  
109 -- (void)rejectPKRequest:(NSString *)userID reason:(NSString *)reason;  
110 -  
111 -@end  
1 -//  
2 -// RoomUtil.h  
3 -// TXLiteAVDemo  
4 -//  
5 -// Created by lijie on 2017/12/11.  
6 -// Copyright © 2017年 Tencent. All rights reserved.  
7 -//  
8 -  
9 -#import <Foundation/Foundation.h>  
10 -#import <TXLiteAVSDK_Smart/TXLivePlayListener.h>  
11 -  
12 -@interface RoomUtil : NSObject  
13 -+ (NSString *)getDeviceModelName;  
14 -@end  
15 -  
16 -  
17 -/**  
18 - 播放开始的回调  
19 - */  
20 -typedef void (^IPlayBeginBlock)();  
21 -  
22 -/**  
23 - 播放过程中发生错误时的回调  
24 - */  
25 -typedef void (^IPlayErrorBlock)(int errCode, NSString *errMsg);  
26 -  
27 -  
28 -@protocol IRoomLivePlayListener <NSObject>  
29 -@optional  
30 --(void)onLivePlayEvent:(NSString*) userID withEvtID:(int)evtID andParam:(NSDictionary*)param;  
31 -  
32 -@optional  
33 --(void)onLivePlayNetStatus:(NSString*) userID withParam: (NSDictionary*) param;  
34 -@end  
35 -  
36 -  
37 -@interface RoomLivePlayListenerWrapper : NSObject <TXLivePlayListener>  
38 -@property (nonatomic, strong) NSString* userID;  
39 -@property (nonatomic, weak) id<IRoomLivePlayListener> delegate;  
40 -@property (nonatomic, copy) IPlayBeginBlock playBeginBlock;  
41 -@property (nonatomic, copy) IPlayErrorBlock playErrorBlock;  
42 -  
43 -- (void)clear;  
44 -  
45 -@end  
46 -  
47 -  
48 -@protocol RoomReportDelegate <NSObject>  
49 --(void)onReportStatisticInfo:(NSDictionary*)statisticInfo;  
50 -@end  
51 -  
52 -  
53 -@interface RoomStatisticInfo : NSObject  
54 -@property (nonatomic, weak) id<RoomReportDelegate> delegate;  
55 -  
56 -@property(atomic, retain) NSString* str_appid;  
57 -@property(atomic, retain) NSString* str_platform;  
58 -@property(atomic, retain) NSString* str_userid;  
59 -@property(atomic, retain) NSString* str_roomid;  
60 -@property(atomic, retain) NSString* str_room_creator;  
61 -@property(atomic, retain) NSString* str_streamid;  
62 -@property(atomic, assign) SInt64 int64_ts_enter_room;  
63 -@property(atomic, assign) SInt64 int64_tc_join_group;  
64 -@property(atomic, assign) SInt64 int64_tc_get_pushers;  
65 -@property(atomic, assign) SInt64 int64_tc_play_stream;  
66 -@property(atomic, assign) SInt64 int64_tc_get_pushurl;  
67 -@property(atomic, assign) SInt64 int64_tc_push_stream;  
68 -@property(atomic, assign) SInt64 int64_tc_add_pusher;  
69 -@property(atomic, assign) SInt64 int64_tc_enter_room;  
70 -@property(atomic, retain) NSString* str_appversion;  
71 -@property(atomic, retain) NSString* str_sdkversion;  
72 -@property(atomic, retain) NSString* str_common_version; //公共库版本号,微信专用  
73 -@property(atomic, retain) NSString* str_username;  
74 -@property(atomic, retain) NSString* str_device;  
75 -@property(atomic, retain) NSString* str_device_type; //设备及OS版本号,微信专用  
76 -@property(atomic, retain) NSString* str_play_info;  
77 -@property(atomic, retain) NSString* str_push_info;  
78 -@property(atomic, assign) SInt32 int32_report_type; //0:RTCRoom 1:RoomService  
79 -  
80 -@property(atomic, assign) SInt64 int64_ts_push_stream;  
81 -@property(atomic, assign) SInt64 int64_ts_play_stream;  
82 -  
83 --(void) clean;  
84 --(void) setStreamPushUrl: (NSString*) strStreamUrl;  
85 --(void) setPlayStreamBeginTS: (SInt64)ts;  
86 --(void) updatePlayStreamSuccessTS: (SInt64)ts;  
87 --(void) updateAddPusherSuccessTS: (SInt64)ts;  
88 --(void) reportStatisticInfo;  
89 -@end  
90 -  
@@ -335,7 +335,7 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong, getter=defau @@ -335,7 +335,7 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong, getter=defau
335 /// 初始化 SDK 335 /// 初始化 SDK
336 /// \param option 可选的 SDK 配置 336 /// \param option 可选的 SDK 配置
337 /// 337 ///
338 -- (void)startWithOption:(HHSDKOptions * _Nullable)option; 338 +- (void)startWithOption:(HHSDKOptions * _Nonnull)option;
339 /// 登录账户 339 /// 登录账户
340 /// \param userToken 用户的唯一标志 340 /// \param userToken 用户的唯一标志
341 /// 341 ///
@@ -405,7 +405,6 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong, getter=defau @@ -405,7 +405,6 @@ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong, getter=defau
405 405
406 406
407 407
408 -enum PermissionType : NSInteger;  
409 408
410 /// 视频管理器代理 409 /// 视频管理器代理
411 SWIFT_PROTOCOL("_TtP12hhVDoctorSDK16HHMVideoDelegate_") 410 SWIFT_PROTOCOL("_TtP12hhVDoctorSDK16HHMVideoDelegate_")
@@ -420,7 +419,7 @@ SWIFT_PROTOCOL("_TtP12hhVDoctorSDK16HHMVideoDelegate_") @@ -420,7 +419,7 @@ SWIFT_PROTOCOL("_TtP12hhVDoctorSDK16HHMVideoDelegate_")
420 /// 呼叫失败(主叫) 419 /// 呼叫失败(主叫)
421 /// \param error 错误信息 420 /// \param error 错误信息
422 /// 421 ///
423 -- (void)onFail:(int32_t)errorCode errrorStr:(NSString * _Nullable)errrorStr; 422 +- (void)onFail:(NSInteger)errorCode errrorStr:(NSString * _Nullable)errrorStr;
424 - (void)onCancel; 423 - (void)onCancel;
425 /// 通话已结束 (接通之后才有结束) 424 /// 通话已结束 (接通之后才有结束)
426 - (void)callDidFinish; 425 - (void)callDidFinish;
@@ -434,10 +433,8 @@ SWIFT_PROTOCOL("_TtP12hhVDoctorSDK16HHMVideoDelegate_") @@ -434,10 +433,8 @@ SWIFT_PROTOCOL("_TtP12hhVDoctorSDK16HHMVideoDelegate_")
434 /// \param accept 接受或者拒接 433 /// \param accept 接受或者拒接
435 /// 434 ///
436 - (void)onResponse:(BOOL)accept; 435 - (void)onResponse:(BOOL)accept;
437 -/// 缺少必要权限  
438 -/// \param type 缺少的权限类型  
439 -///  
440 -- (void)onLeakPermission:(enum PermissionType)type; 436 +/// 强制下线
  437 +- (void)onForceOffline;
441 @end 438 @end
442 439
443 440
@@ -511,8 +508,6 @@ SWIFT_CLASS("_TtC12hhVDoctorSDK12HHSDKOptions") @@ -511,8 +508,6 @@ SWIFT_CLASS("_TtC12hhVDoctorSDK12HHSDKOptions")
511 @property (nonatomic, copy) NSString * _Nonnull productId; 508 @property (nonatomic, copy) NSString * _Nonnull productId;
512 /// 推送证书名 509 /// 推送证书名
513 @property (nonatomic, copy) NSString * _Nullable cerName; 510 @property (nonatomic, copy) NSString * _Nullable cerName;
514 -/// 呼叫进入是否需要等待(呼入present 控制器前处理其他逻辑,3秒后自动失效)  
515 -@property (nonatomic) BOOL shouldWaingCall;  
516 /// 是否开启美颜 511 /// 是否开启美颜
517 @property (nonatomic) BOOL allowBeauty; 512 @property (nonatomic) BOOL allowBeauty;
518 /// 允许视频完成后评价 513 /// 允许视频完成后评价
@@ -11,18 +11,6 @@ @@ -11,18 +11,6 @@
11 #endif 11 #endif
12 12
13 #import "HHMBProgressHUD.h" 13 #import "HHMBProgressHUD.h"
14 -#import "HHCompatibilityMacros.h"  
15 -#import "HHHTTPSessionManager.h"  
16 -#import "HHNetworking.h"  
17 -#import "HHNetworkReachabilityManager.h"  
18 -#import "HHSecurityPolicy.h"  
19 -#import "HHURLRequestSerialization.h"  
20 -#import "HHURLResponseSerialization.h"  
21 -#import "HHURLSessionManager.h"  
22 -#import "RoomDef.h"  
23 -#import "RoomMsgMgr.h"  
24 -#import "RoomUtil.h"  
25 -#import "RTCRoom.h"  
26 #import "ObjectMapper.h" 14 #import "ObjectMapper.h"
27 #import "CGGeometry+RSKImageCropper.h" 15 #import "CGGeometry+RSKImageCropper.h"
28 #import "RSKImageCropper.h" 16 #import "RSKImageCropper.h"
@@ -36,7 +24,6 @@ @@ -36,7 +24,6 @@
36 #import "PhotoPicker.h" 24 #import "PhotoPicker.h"
37 #import "HHCameraUtil.h" 25 #import "HHCameraUtil.h"
38 #import "HHPHAssetManager.h" 26 #import "HHPHAssetManager.h"
39 -#import "HttpsDNSAuth.h"  
40 #import "HHAnimatedImageRep.h" 27 #import "HHAnimatedImageRep.h"
41 #import "HHImageCache.h" 28 #import "HHImageCache.h"
42 #import "HHImageCacheConfig.h" 29 #import "HHImageCacheConfig.h"