我遇到了AFNetworking的问题。 我的web服务期望两个NSString类型的参数返回YES或NO。 我的代码就是这个
AFHTTPClient * httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@“http://webservice.com”]];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET" path:path parameters:@{ @"password":@"password", @"username":@"username"} ]; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request]; operation.outputStream = [NSOutputStream outputStreamToFileAtPath:path append:NO]; [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"success: %@", operation.responseString); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"error: %@", operation.responseString); } ]; NSLog(@"%@", operation.request); [operation start];
不写:
NSLog(@"success: %@", operation.responseString)
; ou
NSLog(@“error:%@”,operation.responseString);
也就是说,不会进入blcok。
有什么建议吗?
问候