Can AFNetworking return data Synchronously ? (inside a block?)
I have a function using AFJSONRequestOperation , and i wish to return the result only after success. Could you point me in the right direction? I'm still a bit clueless with blocks and AFNetworking specifically.

<!-- language: lang-cpp -->

    -(id)someFunction{
        __block id data;
       
        AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
            success:^(NSURLRequest *request, NSHTTPURLResponse *response, id json){
                data = json;
                return data; // won't work
            }
            failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){
                                                                                            
            }];
    
    
    
        NSOperationQueue *queue = [[NSOperationQueue alloc] init];
        [queue addOperation: operation];
    
        return data; // will return nil since the block doesn't "lock" the app.
    }

Thanks for any help! :) 
Can AFNetworking return data Synchronously ? (inside a block?)
===

I have a function using AFJSONRequestOperation , and i wish to return the result only after success. Could you point me in the right direction? I'm still a bit clueless with blocks and AFNetworking specifically.

<!-- language: lang-cpp -->

    -(id)someFunction{
        __block id data;
       
        AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
            success:^(NSURLRequest *request, NSHTTPURLResponse *response, id json){
                data = json;
                return data; // won't work
            }
            failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){
                                                                                            
            }];
    
    
    
        NSOperationQueue *queue = [[NSOperationQueue alloc] init];
        [queue addOperation: operation];
    
        return data; // will return nil since the block doesn't "lock" the app.
    }

Thanks for any help! :) 