Returning NSXMLParser as response object on all platforms, and documenting the change (Thanks to Zac Bowling for the suggestion)

Don't set the responseParser delegate to nil in -dealloc
This commit is contained in:
Mattt Thompson 2011-11-10 11:47:28 -06:00
parent 67a45388a6
commit bb4aaa68fa
2 changed files with 4 additions and 7 deletions

View file

@ -34,6 +34,10 @@
- `application/xml` - `application/xml`
- `text/xml` - `text/xml`
## Use With AFHTTPClient
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.
*/ */
@interface AFXMLRequestOperation : AFHTTPRequestOperation { @interface AFXMLRequestOperation : AFHTTPRequestOperation {
@private @private

View file

@ -122,7 +122,6 @@ static dispatch_queue_t xml_request_operation_processing_queue() {
} }
- (void)dealloc { - (void)dealloc {
_responseXMLParser.delegate = nil;
[_responseXMLParser release]; [_responseXMLParser release];
#if __MAC_OS_X_VERSION_MIN_REQUIRED #if __MAC_OS_X_VERSION_MIN_REQUIRED
@ -189,15 +188,9 @@ static dispatch_queue_t xml_request_operation_processing_queue() {
}); });
} }
} else { } else {
#if __MAC_OS_X_VERSION_MIN_REQUIRED
if (success) {
success(self, self.responseXMLDocument);
}
#else
if (success) { if (success) {
success(self, self.responseXMLParser); success(self, self.responseXMLParser);
} }
#endif
} }
}; };
} }