相关疑难解决方法(0)

块内函数的返回值

我正在使用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返回给函数.显然返回不起作用.

block objective-c afnetworking

13
推荐指数
1
解决办法
1万
查看次数

标签 统计

afnetworking ×1

block ×1

objective-c ×1