ios - AFNetworking parsing json deeper -
i´m using afnetworking parse json , absolutely love it.
now want go lever deeper. json output looks this
-result -0 rezept_id : value1 rezept_name : value2 rezept_zubereitung : value3
everything works fine until here , can parse value. goes on
-rezept_bilder -0 -bigfix file : value4 file_path : value5
now want parse json attribute file value (value4) , display in image view. display image if on main.
[self.restuarantimageview setimagewithurl:[nsurl urlwithstring:[self.restuarantdetail objectforkey:@"file"]]];
but how tell him file value not on main under
-rezept_bilder -0 - bigfix
here code using parse data point i'm stuck.
-(void)makerestuarantsrequests3{ nsurl *url = [nsurl urlwithstring:@"http://api.chefkoch.de/api/1.0/api-recipe.php? zufall=1&divisor=0&limit=1"]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:request success:^(nsurlrequest *request, nshttpurlresponse *response, id responseobject) { self.googleplacesarrayfromafnetworking3 = [responseobject objectforkey:@"result"]; nsdictionary *tempdictionary3= [self.googleplacesarrayfromafnetworking3 objectatindex:0]; self.zubereitung.text = [tempdictionary3 objectforkey:@"rezept_zubereitung"]; self.name.text = [tempdictionary3 objectforkey:@"rezept_name"]; } failure:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error, id responseobject) { nslog(@"request failed error: %@, %@", error, error.userinfo); }];
thanks in advance , sorry bad english, hope guys understand problem is!
-----------edit
thanks got working :d
you realy healed me
this how did it
-(void)makerestuarantsrequests3{ nsurl *url = [nsurl urlwithstring:@"http://api.chefkoch.de/api/1.0/api-recipe.php?zufall=1&divisor=0&limit=1"]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:request success:^(nsurlrequest *request, nshttpurlresponse *response, id responseobject) { self.googleplacesarrayfromafnetworking3 = [responseobject objectforkey:@"result"]; nsdictionary *tempdictionary3= [self.googleplacesarrayfromafnetworking3 objectatindex:0]; self.zubereitung.text = [tempdictionary3 objectforkey:@"rezept_zubereitung"]; self.name.text = [tempdictionary3 objectforkey:@"rezept_name"]; self.googleplacesarrayfromafnetworking5 =[tempdictionary3 objectforkey:@"rezept_bilder"]; nsdictionary *tempdictionary4= [self.googleplacesarrayfromafnetworking5 objectatindex:0]; nsdictionary *tempdictionary5 = [tempdictionary4 objectforkey:@"bigfix"]; [self.bild setimagewithurl:[nsurl urlwithstring:[tempdictionary5 objectforkey:@"file"]]];
try change below , see. if possible post json of responseobject, see more clearly.
self.googleplacesarrayfromafnetworking3 = [responseobject objectforkey:@"result"]; nsdictionary *tempdictionary3= [[self.googleplacesarrayfromafnetworking3 objectatindex:0] obejctforkey:@"bigfix"]; self.zubereitung.text = [tempdictionary3 objectforkey:@"rezept_zubereitung"]; self.name.text = [tempdictionary3 objectforkey:@"rezept_name"];
Comments
Post a Comment