我在类中创建一个方法。完成处理程序在目标c中的方法
- (void)getTableData:(NSString *)URL withCompletionHandler:(void (^)(NSString *))handler{
__block NSDictionary *JSON;
[manager POST:urlString parameters:jsonDict success:^(AFHTTPRequestOperation *operation, id responseObject){
JSON = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:&error];
handler(JSON);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error %@",error);
// handle failure
}];
}
和由
[ObjOfSecondClass getTableData:BILL withCompletionHandler:^(NSString* returnString)handler{
}];
调用它在另一个类中它示出了在处理预期表达错误。
你想在你的回调中做什么? – iPeter
NSDictionary * JSON; – Lenin
我还没有真正理解你的问题。你可以请更具体吗? – iPeter