我有以下方法,我已经验证了for in循环运行,但是其中的代码并没有。我真的不能解释自己这种行为。
- (void) getReviews:(NSString *)packageID withCompletionHandler:(ResponseBlock)completionBlock {
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
NSDictionary* parameters = @{@"packageID" : packageID};
[manager GET:(@"theurl") parameters:parameters progress:nil success:^(NSURLSessionTask *task, id responseObject) {
NSTEasyJSON* JSON = [NSTEasyJSON withObject:responseObject];
NSString *jsonString = JSON.string;
if ([jsonString containsString:@"Could"]) {
completionBlock(jsonString);
} else {
for (NSTEasyJSON *arrayItemJSON in JSON.dictionary) {
NSString* rte = arrayItemJSON[@"rate"].string;
NSString* ttl = arrayItemJSON[@"title"].string;
NSString* rvw = arrayItemJSON[@"review"].string;
NSString* uname = arrayItemJSON[@"username"].string;
NSLog(@"This is the rate %@", rte);
}
}
completionBlock(jsonString);
} failure:^(NSURLSessionTask *operation, NSError *error) {
completionBlock(@"Error ocurred");
}];
}