I'm new with AFNetworking framework. I've got implemented simple GET request to the server.
@implementation MyClass
…
- (void)signInWithUsername:(NSString *)username andPassword:(NSString *)password withBlock:(SignInBlock)block {
[client getPath:@"test.json" parameters:Nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
block(YES, [responseObject objectForKey:@"access_token"]);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
block(NO, nil);
}];
}
block declaration:
typedef void (^SignInBlock)(BOOL success, NSString *token);
I haven't any idea how to mock this AFHTTPClient
object correctly to check if block from argument (SignInBlock
) has been called and with what arguments. How can I do that correctly?
Thank you in advance.
I've done it.