Sam
Sam

Reputation: 15761

AFNetworking JSONRequestOperation

AFJSONRequestOperation has a successBlock block for when the request succeeds, but there is no way to set the "Authentication Block" other than on the operation itself, so if that fails then there is no way to send back to the caller of the AFJSONRequestOperation. Is that correct, or am I missing something?

I would expect to be able to tell the caller that the whole operation failed because authorization failed.

Upvotes: 0

Views: 215

Answers (1)

oiledCode
oiledCode

Reputation: 8649

Actually the method takes two block as a parameters success and failure

AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:successBlock failure:failureBlock];

So in the failure block you should be able to notify the caller of the failure

Upvotes: 2

Related Questions