在我的应用程序中,我应该下载一些 JSON 文件,然后将这些 URL 存储在 plist 中,正如您在我的代码中看到的那样。在我创建一个“AFHTTPRequestOperationManager”并创建一个循环之后,我为“url_list”的数字添加一些操作。
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"url_json" ofType:@"plist"];
NSArray *url_list = [NSArray arrayWithContentsOfFile:plistPath];
self.manager = [AFHTTPRequestOperationManager manager];
for (id element in url_list){
NSURL *url = [NSURL URLWithString:element];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request];
op.responseSerializer = [AFHTTPResponseSerializer serializer];
[op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
[self.manager.operationQueue addOperation:op];
}
现在这段代码应该没问题,但我想要两个信息:
知道我的“经理”的进度值的方法是什么?,因为我想知道单个进度值中所有操作的状态
我想知道操作何时完成,因为当操作完成时,我应该将“responseObject”传递给解析此数据的方法
你能帮助我吗?