我正在使用AFNetworking从服务器获取数据:
-(NSArray)some function {
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
success: ^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSArray *jsonArray =[JSON valueForKey:@"posts"];
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {}
}
Run Code Online (Sandbox Code Playgroud)
所以我在这里要做的是将jsonArray返回给函数.显然返回不起作用.