Sunday, 15 January 2012

ios - How to get JSON out of AFNetworing 2.0 GET Method -



ios - How to get JSON out of AFNetworing 2.0 GET Method -

i using afnetworking create bunch of api calls @ 1 time instagram. using afnetworking 2.0 afhttpsessionmanager request.

i using loop create url requires location id searching. loop makes in case 3 separate api calls , stores each response in array.

i create mutable array store objects in array. need mutable array 1 time has 3 objects in it. have tried passing info method, same problem - can't utilize array until previous method done running.

-(void)sendgetrequestforlocationmedia:(nsmutablearray*)mutablearray{ (int = 0; i<3; i++) { nsstring *getlocationmediastring = [[nsstring alloc]initwithformat:@"locations/%@/media/recent?client_id=%@", self.locationidobjectarray[i], client_id]; nslog(@"getlocationmediastring %@", getlocationmediastring); [[lpauthclient sharedclient]get:getlocationmediastring parameters:nil success:^(nsurlsessiondatatask *task, id responseobject) { { nshttpurlresponse *httpresponse = (nshttpurlresponse *)task.response; if (httpresponse.statuscode == 200) { dispatch_async(dispatch_get_main_queue(), ^{ _locationmediaarray = responseobject[@"data"]; if (!_locationmediajsonarray) { _locationmediajsonarray = [[nsmutablearray alloc]init]; } (nsdictionary *dictionary in _locationmediaarray) { [_locationmediajsonarray addobject:dictionary]; } }); } } } failure:^(nsurlsessiondatatask *task, nserror *error) { nslog(@"failure %@", error); }]; } }

ios arrays json afnetworking-2

No comments:

Post a Comment