in循环中的代码未执行

时间:2018-04-01 17:28:14

标签: ios objective-c afnetworking-3

我有以下方法,我已经验证了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");
    }];

}

0 个答案:

没有答案