Merge branch 'master' of github.com:AFNetworking/AFNetworking
This commit is contained in:
commit
7a3d6560c0
6 changed files with 19 additions and 19 deletions
|
|
@ -114,7 +114,7 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete
|
|||
|
||||
## URL Construction Using Relative Paths
|
||||
|
||||
Both `requestWithMethod:path:parameters` and `multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interract:
|
||||
Both `requestWithMethod:path:parameters` and `multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interact:
|
||||
|
||||
NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];
|
||||
[NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo
|
||||
|
|
@ -138,7 +138,7 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete
|
|||
///---------------------------------------
|
||||
|
||||
/**
|
||||
The url used as the base for paths specified in methods such as `getPath:parameteres:success:failure`
|
||||
The url used as the base for paths specified in methods such as `getPath:parameters:success:failure`
|
||||
*/
|
||||
@property (readonly, nonatomic, retain) NSURL *baseURL;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string);
|
|||
*/
|
||||
@property (nonatomic, assign) dispatch_queue_t failureCallbackQueue;
|
||||
|
||||
///-------------------------------------------------------------
|
||||
/// @name Managing Accceptable HTTP Status Codes & Content Types
|
||||
///-------------------------------------------------------------
|
||||
///------------------------------------------------------------
|
||||
/// @name Managing Acceptable HTTP Status Codes & Content Types
|
||||
///------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Returns an `NSIndexSet` object containing the ranges of acceptable HTTP status codes. When non-`nil`, the operation will set the `error` property to an error in `AFErrorDomain`. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||
|
|
@ -78,7 +78,7 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string);
|
|||
+ (NSIndexSet *)acceptableStatusCodes;
|
||||
|
||||
/**
|
||||
Adds status codes to the set of acceptable HTTP status codes returned by `+acceptableStatusCodes` in subsequent calls by this class and its descendents.
|
||||
Adds status codes to the set of acceptable HTTP status codes returned by `+acceptableStatusCodes` in subsequent calls by this class and its descendants.
|
||||
|
||||
@param statusCodes The status codes to be added to the set of acceptable HTTP status codes
|
||||
*/
|
||||
|
|
@ -92,7 +92,7 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string);
|
|||
+ (NSSet *)acceptableContentTypes;
|
||||
|
||||
/**
|
||||
Adds content types to the set of acceptable MIME types returned by `+acceptableContentTypes` in subsequent calls by this class and its descendents.
|
||||
Adds content types to the set of acceptable MIME types returned by `+acceptableContentTypes` in subsequent calls by this class and its descendants.
|
||||
|
||||
@param contentTypes The content types to be added to the set of acceptable MIME types
|
||||
*/
|
||||
|
|
@ -118,7 +118,7 @@ extern NSSet * AFContentTypesFromHTTPHeader(NSString *string);
|
|||
Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed.
|
||||
|
||||
@param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request.
|
||||
@param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occured during the request.
|
||||
@param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request.
|
||||
|
||||
@discussion This method should be overridden in subclasses in order to specify the response object passed into the success block.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
@param urlRequest The request object to be loaded asynchronously during execution of the operation
|
||||
@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 JSON object created from the response data of request.
|
||||
@param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse data as JSON. 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.
|
||||
@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 JSON. 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.
|
||||
|
||||
@return A new JSON request operation
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
Indicates an error occured in AFNetworking.
|
||||
Indicates an error occurred in AFNetworking.
|
||||
|
||||
@discussion Error codes for AFNetworkingErrorDomain correspond to codes in NSURLErrorDomain.
|
||||
*/
|
||||
|
|
@ -61,7 +61,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification;
|
|||
- `connection:canAuthenticateAgainstProtectionSpace:`
|
||||
- `connection:didReceiveAuthenticationChallenge:`
|
||||
|
||||
If any of these methods are overriden in a subclass, they _must_ call the `super` implementation first.
|
||||
If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first.
|
||||
|
||||
## Class Constructors
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification;
|
|||
@property (readonly, nonatomic, retain) NSURLResponse *response;
|
||||
|
||||
/**
|
||||
The error, if any, that occured in the lifecycle of the request.
|
||||
The error, if any, that occurred in the lifecycle of the request.
|
||||
*/
|
||||
@property (readonly, nonatomic, retain) NSError *error;
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification;
|
|||
|
||||
@see setDownloadProgressBlock
|
||||
*/
|
||||
- (void)setUploadProgressBlock:(void (^)(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block;
|
||||
- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block;
|
||||
|
||||
/**
|
||||
Sets a callback to be called when an undetermined number of bytes have been downloaded from the server.
|
||||
|
|
@ -225,7 +225,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification;
|
|||
|
||||
@see setUploadProgressBlock
|
||||
*/
|
||||
- (void)setDownloadProgressBlock:(void (^)(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block;
|
||||
- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block;
|
||||
|
||||
///-------------------------------------------------
|
||||
/// @name Setting NSURLConnection Delegate Callbacks
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ NSString * const AFNetworkingErrorDomain = @"com.alamofire.networking.error";
|
|||
NSString * const AFNetworkingOperationDidStartNotification = @"com.alamofire.networking.operation.start";
|
||||
NSString * const AFNetworkingOperationDidFinishNotification = @"com.alamofire.networking.operation.finish";
|
||||
|
||||
typedef void (^AFURLConnectionOperationProgressBlock)(NSInteger bytes, long long totalBytes, long long totalBytesExpected);
|
||||
typedef void (^AFURLConnectionOperationProgressBlock)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected);
|
||||
typedef BOOL (^AFURLConnectionOperationAuthenticationAgainstProtectionSpaceBlock)(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace);
|
||||
typedef void (^AFURLConnectionOperationAuthenticationChallengeBlock)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge);
|
||||
typedef NSCachedURLResponse * (^AFURLConnectionOperationCacheResponseBlock)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse);
|
||||
|
|
@ -287,11 +287,11 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
|||
}
|
||||
#endif
|
||||
|
||||
- (void)setUploadProgressBlock:(void (^)(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block {
|
||||
- (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block {
|
||||
self.uploadProgress = block;
|
||||
}
|
||||
|
||||
- (void)setDownloadProgressBlock:(void (^)(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block {
|
||||
- (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block {
|
||||
self.downloadProgress = block;
|
||||
}
|
||||
|
||||
|
|
@ -563,7 +563,7 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
|
||||
if (self.downloadProgress) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.downloadProgress((long long)[data length], self.totalBytesRead, self.response.expectedContentLength);
|
||||
self.downloadProgress([data length], self.totalBytesRead, self.response.expectedContentLength);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
@param urlRequest The request object to be loaded asynchronously during execution of the operation
|
||||
@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.
|
||||
@param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the resonse 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.
|
||||
@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.
|
||||
|
||||
@return A new XML request operation
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue