ios - AFNetworking miss implemetation -
afhttprequestoperationmanager has implementation:
- (afhttprequestoperation *)httprequestoperationwithrequest:(nsurlrequest *)request success:(void (^)(afhttprequestoperation *operation, id responseobject))success failure:(void (^)(afhttprequestoperation *operation, nserror *error))failure { afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; operation.responseserializer = self.responseserializer; operation.shouldusecredentialstorage = self.shouldusecredentialstorage; operation.credential = self.credential; operation.securitypolicy = self.securitypolicy; [operation setcompletionblockwithsuccess:success failure:failure]; return operation; }
when use method, success , failure blocks never call. after put line in implementation:
[self.operationqueue addoperation:operation];
it works. why afnetworking 2.0 afhttprequestoperationmanager miss line or don't understand method? thanks.
httprequestoperationwithrequest
creates operation, not execute it. when add operation operation queue created call:
[self.operationqueue addoperation:operation];
you executing operation created. success , failure blocks called.
Comments
Post a Comment