i made using the code below, you just need to put into action the following: -
-(void)restore{ @try { NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"%@%@?userid=%@",kHOSTPATH,kCSVLIST,[[cntrAppDelegate setServerDetails] valueForKey:@"kUSERID"]]]; NSMutableURLRequest *requestMutable = [[NSMutableURLRequest alloc] init]; [requestMutable setURL:url]; NSError *error = [[NSError alloc] init]; NSHTTPURLResponse *response = nil; NSData *urlData=[NSURLConnection sendSynchronousRequest:requestMutable returningResponse:&response error:&error]; NSLog(@"Response code: %d", [response statusCode]); if ([response statusCode] >=200 && [response statusCode] <300) { NSString *responseData = [[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding]; NSLog(@"Response ==> %@", responseData); SBJsonParser *jsonParser = [SBJsonParser new]; NSDictionary *jsonData = (NSDictionary *) [jsonParser objectWithString:responseData error:nil]; NSLog(@"--------=========%@============-------------",jsonData); NSDictionary *dic = [jsonData objectForKey:@"Root"]; NSLog(@"---------------------ROOT VALUE IS %@",dic); NSLog(@"----------------COUNT IS %d",[dic count]); for (int i = 0; i < [dic count]; i++) { NSString *str = [[dic valueForKey:@"CSV_File"]objectAtIndex:i]; NSLog(@"STR IS %@",str); [self.arrListOfCSV addObject:str]; } if ([jsonData valueForKey:@"Root"] == 0) { } else { } }
source share