objective c - JSON Data Not Parsed in iOS -


i newbie in ios development. want parse json data webservices have written folliwing code

- (void)viewdidload {  nsurl * url=[nsurl urlwithstring:[nsstring stringwithformat:@"http://www.janvajevu.com/webservice/latest_post.php?page=%d",pagenum]]; dispatch_async(kbgqueue, ^{     data = [nsdata datawithcontentsofurl: url];     [self performselectoronmainthread:@selector(fetcheddata:) withobject:data waituntildone:yes]; });  } -(void)fetcheddata:(nsdata *)responsedata { if (responsedata.length > 0) {     nserror* error;     self.json= [nsjsonserialization jsonobjectwithdata:responsedata options:kniloptions error:&error];     if ([[_json objectforkey:@"data"] iskindofclass:[nsarray class]])     {         nsarray *arr = (nsarray *)[_json objectforkey:@"data"];         [self.navuarray addobjectsfromarray:arr];         [self.navutable reloaddata];          nslog(@"json data %@",self.navuarray);     }     self.navutable.hidden=false; } 

here self.json json dictionary , self.navuarray nsmutablearray when print array returns num. please give me solution it.

its navuarray not initialized before adding objects array. initialize before call data , add objects it.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -