afmotion 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -1
- data/Gemfile.lock +21 -28
- data/lib/afmotion/patch/NSURLRequest_params.rb +4 -2
- data/lib/afmotion/version.rb +1 -1
- metadata +2 -53
- data/vendor/Pods/AFNetworking/AFNetworking.podspec +0 -28
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -574
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1187
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -341
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -108
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -237
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -136
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -131
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -44
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -145
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -295
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -652
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -169
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -180
- data/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/vendor/Pods/AFNetworking/README.md +0 -179
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -574
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -108
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -44
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -295
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -574
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -108
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -44
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -295
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Pods-Acknowledgements.markdown +0 -26
- data/vendor/Pods/Pods-Acknowledgements.plist +0 -56
- data/vendor/Pods/Pods-prefix.pch +0 -14
- data/vendor/Pods/Pods-resources.sh +0 -19
- data/vendor/Pods/Pods.bridgesupport +0 -617
- data/vendor/Pods/Pods.xcconfig +0 -7
- data/vendor/Pods/PodsDummy_Pods.m +0 -4
@@ -1,295 +0,0 @@
|
|
1
|
-
// AFURLConnectionOperation.h
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.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
|
-
|
25
|
-
#import <Availability.h>
|
26
|
-
|
27
|
-
/**
|
28
|
-
`AFURLConnectionOperation` is a subclass of `NSOperation` that implements `NSURLConnection` delegate methods.
|
29
|
-
|
30
|
-
## Subclassing Notes
|
31
|
-
|
32
|
-
This is the base class of all network request operations. You may wish to create your own subclass in order to implement additional `NSURLConnection` delegate methods (see "`NSURLConnection` Delegate Methods" below), or to provide additional properties and/or class constructors.
|
33
|
-
|
34
|
-
If you are creating a subclass that communicates over the HTTP or HTTPS protocols, you may want to consider subclassing `AFHTTPRequestOperation` instead, as it supports specifying acceptable content types or status codes.
|
35
|
-
|
36
|
-
## NSURLConnection Delegate Methods
|
37
|
-
|
38
|
-
`AFURLConnectionOperation` implements the following `NSURLConnection` delegate methods:
|
39
|
-
|
40
|
-
- `connection:didReceiveResponse:`
|
41
|
-
- `connection:didReceiveData:`
|
42
|
-
- `connectionDidFinishLoading:`
|
43
|
-
- `connection:didFailWithError:`
|
44
|
-
- `connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:`
|
45
|
-
- `connection:willCacheResponse:`
|
46
|
-
- `connection:canAuthenticateAgainstProtectionSpace:`
|
47
|
-
- `connection:didReceiveAuthenticationChallenge:`
|
48
|
-
|
49
|
-
If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.
|
50
|
-
|
51
|
-
## Class Constructors
|
52
|
-
|
53
|
-
Class constructors, or methods that return an unowned instance, are the preferred way for subclasses to encapsulate any particular logic for handling the setup or parsing of response data. For instance, `AFJSONRequestOperation` provides `JSONRequestOperationWithRequest:success:failure:`, which takes block arguments, whose parameter on for a successful request is the JSON object initialized from the `response data`.
|
54
|
-
|
55
|
-
## Callbacks and Completion Blocks
|
56
|
-
|
57
|
-
The built-in `completionBlock` provided by `NSOperation` allows for custom behavior to be executed after the request finishes. It is a common pattern for class constructors in subclasses to take callback block parameters, and execute them conditionally in the body of its `completionBlock`. Make sure to handle cancelled operations appropriately when setting a `completionBlock` (i.e. returning early before parsing response data). See the implementation of any of the `AFHTTPRequestOperation` subclasses for an example of this.
|
58
|
-
|
59
|
-
Subclasses are strongly discouraged from overriding `setCompletionBlock:`, as `AFURLConnectionOperation`'s implementation includes a workaround to mitigate retain cycles, and what Apple rather ominously refers to as ["The Deallocation Problem"](http://developer.apple.com/library/ios/#technotes/tn2109/).
|
60
|
-
|
61
|
-
## NSCoding & NSCopying Conformance
|
62
|
-
|
63
|
-
`AFURLConnectionOperation` conforms to the `NSCoding` and `NSCopying` protocols, allowing operations to be archived to disk, and copied in memory, respectively. However, because of the intrinsic limitations of capturing the exact state of an operation at a particular moment, there are some important caveats to keep in mind:
|
64
|
-
|
65
|
-
### NSCoding Caveats
|
66
|
-
|
67
|
-
- Encoded operations do not include any block or stream properties. Be sure to set `completionBlock`, `outputStream`, and any callback blocks as necessary when using `-initWithCoder:` or `NSKeyedUnarchiver`.
|
68
|
-
- Operations are paused on `encodeWithCoder:`. If the operation was encoded while paused or still executing, its archived state will return `YES` for `isReady`. Otherwise, the state of an operation when encoding will remain unchanged.
|
69
|
-
|
70
|
-
### NSCopying Caveats
|
71
|
-
|
72
|
-
- `-copy` and `-copyWithZone:` return a new operation with the `NSURLRequest` of the original. So rather than an exact copy of the operation at that particular instant, the copying mechanism returns a completely new instance, which can be useful for retrying operations.
|
73
|
-
- A copy of an operation will not include the `outputStream` of the original.
|
74
|
-
- Operation copies do not include `completionBlock`. `completionBlock` often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ operation when copied.
|
75
|
-
*/
|
76
|
-
@interface AFURLConnectionOperation : NSOperation <NSURLConnectionDelegate, NSURLConnectionDataDelegate, NSCoding, NSCopying>
|
77
|
-
|
78
|
-
///-------------------------------
|
79
|
-
/// @name Accessing Run Loop Modes
|
80
|
-
///-------------------------------
|
81
|
-
|
82
|
-
/**
|
83
|
-
The run loop modes in which the operation will run on the network thread. By default, this is a single-member set containing `NSRunLoopCommonModes`.
|
84
|
-
*/
|
85
|
-
@property (nonatomic, strong) NSSet *runLoopModes;
|
86
|
-
|
87
|
-
///-----------------------------------------
|
88
|
-
/// @name Getting URL Connection Information
|
89
|
-
///-----------------------------------------
|
90
|
-
|
91
|
-
/**
|
92
|
-
The request used by the operation's connection.
|
93
|
-
*/
|
94
|
-
@property (readonly, nonatomic, strong) NSURLRequest *request;
|
95
|
-
|
96
|
-
/**
|
97
|
-
The last response received by the operation's connection.
|
98
|
-
*/
|
99
|
-
@property (readonly, nonatomic, strong) NSURLResponse *response;
|
100
|
-
|
101
|
-
/**
|
102
|
-
The error, if any, that occurred in the lifecycle of the request.
|
103
|
-
*/
|
104
|
-
@property (readonly, nonatomic, strong) NSError *error;
|
105
|
-
|
106
|
-
///----------------------------
|
107
|
-
/// @name Getting Response Data
|
108
|
-
///----------------------------
|
109
|
-
|
110
|
-
/**
|
111
|
-
The data received during the request.
|
112
|
-
*/
|
113
|
-
@property (readonly, nonatomic, strong) NSData *responseData;
|
114
|
-
|
115
|
-
/**
|
116
|
-
The string representation of the response data.
|
117
|
-
|
118
|
-
@discussion This method uses the string encoding of the response, or if UTF-8 if not specified, to construct a string from the response data.
|
119
|
-
*/
|
120
|
-
@property (readonly, nonatomic, copy) NSString *responseString;
|
121
|
-
|
122
|
-
///------------------------
|
123
|
-
/// @name Accessing Streams
|
124
|
-
///------------------------
|
125
|
-
|
126
|
-
/**
|
127
|
-
The input stream used to read data to be sent during the request.
|
128
|
-
|
129
|
-
@discussion This property acts as a proxy to the `HTTPBodyStream` property of `request`.
|
130
|
-
*/
|
131
|
-
@property (nonatomic, strong) NSInputStream *inputStream;
|
132
|
-
|
133
|
-
/**
|
134
|
-
The output stream that is used to write data received until the request is finished.
|
135
|
-
|
136
|
-
@discussion By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set.
|
137
|
-
*/
|
138
|
-
@property (nonatomic, strong) NSOutputStream *outputStream;
|
139
|
-
|
140
|
-
///------------------------------------------------------
|
141
|
-
/// @name Initializing an AFURLConnectionOperation Object
|
142
|
-
///------------------------------------------------------
|
143
|
-
|
144
|
-
/**
|
145
|
-
Initializes and returns a newly allocated operation object with a url connection configured with the specified url request.
|
146
|
-
|
147
|
-
@param urlRequest The request object to be used by the operation connection.
|
148
|
-
|
149
|
-
@discussion This is the designated initializer.
|
150
|
-
*/
|
151
|
-
- (id)initWithRequest:(NSURLRequest *)urlRequest;
|
152
|
-
|
153
|
-
///----------------------------------
|
154
|
-
/// @name Pausing / Resuming Requests
|
155
|
-
///----------------------------------
|
156
|
-
|
157
|
-
/**
|
158
|
-
Pauses the execution of the request operation.
|
159
|
-
|
160
|
-
@discussion A paused operation returns `NO` for `-isReady`, `-isExecuting`, and `-isFinished`. As such, it will remain in an `NSOperationQueue` until it is either cancelled or resumed. Pausing a finished, cancelled, or paused operation has no effect.
|
161
|
-
*/
|
162
|
-
- (void)pause;
|
163
|
-
|
164
|
-
/**
|
165
|
-
Whether the request operation is currently paused.
|
166
|
-
|
167
|
-
@return `YES` if the operation is currently paused, otherwise `NO`.
|
168
|
-
*/
|
169
|
-
- (BOOL)isPaused;
|
170
|
-
|
171
|
-
/**
|
172
|
-
Resumes the execution of the paused request operation.
|
173
|
-
|
174
|
-
@discussion Pause/Resume behavior varies depending on the underlying implementation for the operation class. In its base implementation, resuming a paused requests restarts the original request. However, since HTTP defines a specification for how to request a specific content range, `AFHTTPRequestOperation` will resume downloading the request from where it left off, instead of restarting the original request.
|
175
|
-
*/
|
176
|
-
- (void)resume;
|
177
|
-
|
178
|
-
///----------------------------------------------
|
179
|
-
/// @name Configuring Backgrounding Task Behavior
|
180
|
-
///----------------------------------------------
|
181
|
-
|
182
|
-
/**
|
183
|
-
Specifies that the operation should continue execution after the app has entered the background, and the expiration handler for that background task.
|
184
|
-
|
185
|
-
@param handler A handler to be called shortly before the application’s remaining background time reaches 0. The handler is wrapped in a block that cancels the operation, and cleans up and marks the end of execution, unlike the `handler` parameter in `UIApplication -beginBackgroundTaskWithExpirationHandler:`, which expects this to be done in the handler itself. The handler is called synchronously on the main thread, thus blocking the application’s suspension momentarily while the application is notified.
|
186
|
-
*/
|
187
|
-
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
188
|
-
- (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler;
|
189
|
-
#endif
|
190
|
-
|
191
|
-
///---------------------------------
|
192
|
-
/// @name Setting Progress Callbacks
|
193
|
-
///---------------------------------
|
194
|
-
|
195
|
-
/**
|
196
|
-
Sets a callback to be called when an undetermined number of bytes have been uploaded to the server.
|
197
|
-
|
198
|
-
@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 three arguments: 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.
|
199
|
-
*/
|
200
|
-
- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block;
|
201
|
-
|
202
|
-
/**
|
203
|
-
Sets a callback to be called when an undetermined number of bytes have been downloaded from the server.
|
204
|
-
|
205
|
-
@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 number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread.
|
206
|
-
*/
|
207
|
-
- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block;
|
208
|
-
|
209
|
-
///-------------------------------------------------
|
210
|
-
/// @name Setting NSURLConnection Delegate Callbacks
|
211
|
-
///-------------------------------------------------
|
212
|
-
|
213
|
-
/**
|
214
|
-
Sets a block to be executed to determine whether the connection should be able to respond to a protection space's form of authentication, as handled by the `NSURLConnectionDelegate` method `connection:canAuthenticateAgainstProtectionSpace:`.
|
215
|
-
|
216
|
-
@param block A block object to be executed to determine whether the connection should be able to respond to a protection space's form of authentication. The block has a `BOOL` return type and takes two arguments: the URL connection object, and the protection space to authenticate against.
|
217
|
-
|
218
|
-
@discussion If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is defined, `connection:canAuthenticateAgainstProtectionSpace:` will accept invalid SSL certificates, returning `YES` if the protection space authentication method is `NSURLAuthenticationMethodServerTrust`.
|
219
|
-
*/
|
220
|
-
- (void)setAuthenticationAgainstProtectionSpaceBlock:(BOOL (^)(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace))block;
|
221
|
-
|
222
|
-
/**
|
223
|
-
Sets a block to be executed when the connection must authenticate a challenge in order to download its request, as handled by the `NSURLConnectionDelegate` method `connection:didReceiveAuthenticationChallenge:`.
|
224
|
-
|
225
|
-
@param block A block object to be executed when the connection must authenticate a challenge in order to download its request. The block has no return type and takes two arguments: the URL connection object, and the challenge that must be authenticated.
|
226
|
-
|
227
|
-
@discussion If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is defined, `connection:didReceiveAuthenticationChallenge:` will attempt to have the challenge sender use credentials with invalid SSL certificates.
|
228
|
-
*/
|
229
|
-
- (void)setAuthenticationChallengeBlock:(void (^)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge))block;
|
230
|
-
|
231
|
-
/**
|
232
|
-
Sets a block to be executed when the server redirects the request from one URL to another URL, or when the request URL changed by the `NSURLProtocol` subclass handling the request in order to standardize its format, as handled by the `NSURLConnectionDelegate` method `connection:willSendRequest:redirectResponse:`.
|
233
|
-
|
234
|
-
@param block A block object to be executed when the request URL was changed. The block returns an `NSURLRequest` object, the URL request to redirect, and takes three arguments: the URL connection object, the the proposed redirected request, and the URL response that caused the redirect.
|
235
|
-
*/
|
236
|
-
- (void)setRedirectResponseBlock:(NSURLRequest * (^)(NSURLConnection *connection, NSURLRequest *request, NSURLResponse *redirectResponse))block;
|
237
|
-
|
238
|
-
|
239
|
-
/**
|
240
|
-
Sets a block to be executed to modify the response a connection will cache, if any, as handled by the `NSURLConnectionDelegate` method `connection:willCacheResponse:`.
|
241
|
-
|
242
|
-
@param block A block object to be executed to determine what response a connection will cache, if any. The block returns an `NSCachedURLResponse` object, the cached response to store in memory or `nil` to prevent the response from being cached, and takes two arguments: the URL connection object, and the cached response provided for the request.
|
243
|
-
*/
|
244
|
-
- (void)setCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse))block;
|
245
|
-
|
246
|
-
@end
|
247
|
-
|
248
|
-
///----------------
|
249
|
-
/// @name Constants
|
250
|
-
///----------------
|
251
|
-
|
252
|
-
/**
|
253
|
-
## User info dictionary keys
|
254
|
-
|
255
|
-
These keys may exist in the user info dictionary, in addition to those defined for NSError.
|
256
|
-
|
257
|
-
- `NSString * const AFNetworkingOperationFailingURLRequestErrorKey`
|
258
|
-
- `NSString * const AFNetworkingOperationFailingURLResponseErrorKey`
|
259
|
-
|
260
|
-
### Constants
|
261
|
-
|
262
|
-
`AFNetworkingOperationFailingURLRequestErrorKey`
|
263
|
-
The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFNetworkingErrorDomain`.
|
264
|
-
|
265
|
-
`AFNetworkingOperationFailingURLResponseErrorKey`
|
266
|
-
The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFNetworkingErrorDomain`.
|
267
|
-
|
268
|
-
## Error Domains
|
269
|
-
|
270
|
-
The following error domain is predefined.
|
271
|
-
|
272
|
-
- `NSString * const AFNetworkingErrorDomain`
|
273
|
-
|
274
|
-
### Constants
|
275
|
-
|
276
|
-
`AFNetworkingErrorDomain`
|
277
|
-
AFNetworking errors. Error codes for `AFNetworkingErrorDomain` correspond to codes in `NSURLErrorDomain`.
|
278
|
-
*/
|
279
|
-
extern NSString * const AFNetworkingErrorDomain;
|
280
|
-
extern NSString * const AFNetworkingOperationFailingURLRequestErrorKey;
|
281
|
-
extern NSString * const AFNetworkingOperationFailingURLResponseErrorKey;
|
282
|
-
|
283
|
-
///--------------------
|
284
|
-
/// @name Notifications
|
285
|
-
///--------------------
|
286
|
-
|
287
|
-
/**
|
288
|
-
Posted when an operation begins executing.
|
289
|
-
*/
|
290
|
-
extern NSString * const AFNetworkingOperationDidStartNotification;
|
291
|
-
|
292
|
-
/**
|
293
|
-
Posted when an operation finishes.
|
294
|
-
*/
|
295
|
-
extern NSString * const AFNetworkingOperationDidFinishNotification;
|
@@ -1,89 +0,0 @@
|
|
1
|
-
// AFXMLRequestOperation.h
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.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 "AFHTTPRequestOperation.h"
|
25
|
-
|
26
|
-
#import <Availability.h>
|
27
|
-
|
28
|
-
/**
|
29
|
-
`AFXMLRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and working with XML response data.
|
30
|
-
|
31
|
-
## Acceptable Content Types
|
32
|
-
|
33
|
-
By default, `AFXMLRequestOperation` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types:
|
34
|
-
|
35
|
-
- `application/xml`
|
36
|
-
- `text/xml`
|
37
|
-
|
38
|
-
## Use With AFHTTPClient
|
39
|
-
|
40
|
-
When `AFXMLRequestOperation` is registered with `AFHTTPClient`, the response object in the success callback of `HTTPRequestOperationWithRequest:success:failure:` will be an instance of `NSXMLParser`. On platforms that support `NSXMLDocument`, you have the option to ignore the response object, and simply use the `responseXMLDocument` property of the operation argument of the callback.
|
41
|
-
*/
|
42
|
-
@interface AFXMLRequestOperation : AFHTTPRequestOperation
|
43
|
-
|
44
|
-
///----------------------------
|
45
|
-
/// @name Getting Response Data
|
46
|
-
///----------------------------
|
47
|
-
|
48
|
-
/**
|
49
|
-
An `NSXMLParser` object constructed from the response data.
|
50
|
-
*/
|
51
|
-
@property (readonly, nonatomic, strong) NSXMLParser *responseXMLParser;
|
52
|
-
|
53
|
-
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
|
54
|
-
/**
|
55
|
-
An `NSXMLDocument` object constructed from the response data. If an error occurs while parsing, `nil` will be returned, and the `error` property will be set to the error.
|
56
|
-
*/
|
57
|
-
@property (readonly, nonatomic, strong) NSXMLDocument *responseXMLDocument;
|
58
|
-
#endif
|
59
|
-
|
60
|
-
/**
|
61
|
-
Creates and returns an `AFXMLRequestOperation` object and sets the specified success and failure callbacks.
|
62
|
-
|
63
|
-
@param urlRequest The request object to be loaded asynchronously during execution of the operation
|
64
|
-
@param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the XML parser constructed with the response data of request.
|
65
|
-
@param failure A block object to be executed when the operation finishes unsuccessfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network error that occurred.
|
66
|
-
|
67
|
-
@return A new XML request operation
|
68
|
-
*/
|
69
|
-
+ (AFXMLRequestOperation *)XMLParserRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
70
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLParser *XMLParser))success
|
71
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLParser *XMLParser))failure;
|
72
|
-
|
73
|
-
|
74
|
-
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
|
75
|
-
/**
|
76
|
-
Creates and returns an `AFXMLRequestOperation` object and sets the specified success and failure callbacks.
|
77
|
-
|
78
|
-
@param urlRequest The request object to be loaded asynchronously during execution of the operation
|
79
|
-
@param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the XML document created from the response data of request.
|
80
|
-
@param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data as XML. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred.
|
81
|
-
|
82
|
-
@return A new XML request operation
|
83
|
-
*/
|
84
|
-
+ (AFXMLRequestOperation *)XMLDocumentRequestOperationWithRequest:(NSURLRequest *)urlRequest
|
85
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLDocument *document))success
|
86
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLDocument *document))failure;
|
87
|
-
#endif
|
88
|
-
|
89
|
-
@end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
// UIImageView+AFNetworking.h
|
2
|
-
//
|
3
|
-
// Copyright (c) 2011 Gowalla (http://gowalla.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 "AFImageRequestOperation.h"
|
25
|
-
|
26
|
-
#import <Availability.h>
|
27
|
-
|
28
|
-
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
29
|
-
#import <UIKit/UIKit.h>
|
30
|
-
|
31
|
-
/**
|
32
|
-
This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL.
|
33
|
-
*/
|
34
|
-
@interface UIImageView (AFNetworking)
|
35
|
-
|
36
|
-
/**
|
37
|
-
Creates and enqueues an image request operation, which asynchronously downloads the image from the specified URL, and sets it the request is finished. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
|
38
|
-
|
39
|
-
@discussion By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
|
40
|
-
|
41
|
-
@param url The URL used for the image request.
|
42
|
-
*/
|
43
|
-
- (void)setImageWithURL:(NSURL *)url;
|
44
|
-
|
45
|
-
/**
|
46
|
-
Creates and enqueues an image request operation, which asynchronously downloads the image from the specified URL. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
|
47
|
-
|
48
|
-
@param url The URL used for the image request.
|
49
|
-
@param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
|
50
|
-
|
51
|
-
@discussion By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:`
|
52
|
-
*/
|
53
|
-
- (void)setImageWithURL:(NSURL *)url
|
54
|
-
placeholderImage:(UIImage *)placeholderImage;
|
55
|
-
|
56
|
-
/**
|
57
|
-
Creates and enqueues an image request operation, which asynchronously downloads the image with the specified URL request object. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished.
|
58
|
-
|
59
|
-
@param urlRequest The URL request used for the image request.
|
60
|
-
@param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes.
|
61
|
-
@param success A block to be executed when the image request operation finishes successfully, with a status code in the 2xx range, and with an acceptable content type (e.g. `image/png`). This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the request and response parameters will be `nil`.
|
62
|
-
@param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred.
|
63
|
-
|
64
|
-
@discussion If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is executed.
|
65
|
-
*/
|
66
|
-
- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
|
67
|
-
placeholderImage:(UIImage *)placeholderImage
|
68
|
-
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
69
|
-
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;
|
70
|
-
|
71
|
-
/**
|
72
|
-
Cancels any executing image request operation for the receiver, if one exists.
|
73
|
-
*/
|
74
|
-
- (void)cancelImageRequestOperation;
|
75
|
-
|
76
|
-
@end
|
77
|
-
|
78
|
-
#endif
|