Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy it is terminating?
    primarykey
    data
    text
    <pre><code>responseData = [[NSMutableData data] retain]; NSString *requestString = [NSString stringWithFormat:@"http://api.yelp.com/business_review_search?term=&amp;lat=%f&amp;long=%f&amp;radius=10&amp;limit=20&amp;ywsid=XXXXXXXXXX&amp;category=%@",[[ListofLat objectAtIndex:i] floatValue], [[ListofLong objectAtIndex:i] floatValue],appDelegate.categoryField] ; //NSURL *url = [[NSURL alloc] initWithString:requestString]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:requestString]]; /* NSData *tempData =[[NSData alloc] initWithContentsOfURL:url]; NSString *Str = [[NSString alloc] initWithData:tempData encoding:NSUTF8StringEncoding]; NSLog(@"%@",Str);*/ NSURLResponse *response = nil; NSError *error = nil; //getting the data NSData *newData = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error]; //json parse NSString *responseString = [[NSString alloc] initWithData:newData encoding:NSUTF8StringEncoding]; NSDictionary *jsonObject = [responseString JSONValue]; //Accessing JSON content NSLog(@"message : %@", [jsonObject objectForKey:@"message"] ); NSArray *status = [jsonObject objectForKey:@"message"] ; NSLog(@"message : %@", status ); for(NSDictionary *response in status) { NSString *Resptxt =[response objectForKey:@"text"]; txtStatus=[Resptxt copy]; } if([txtStatus isEqualToString : @"OK"]) { UIAlertView *info = [[UIAlertView alloc] initWithTitle:@"Info" message: @"The request completed without error. " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [info show]; [info release]; } </code></pre> <p>I am using above code for json parsing. when compiler comes on this line</p> <blockquote> <p>NSString *Resptxt =[response objectForKey:@"text"]; </p> </blockquote> <p>then compiler terminate and give this error </p> <blockquote> <p><em>*</em> Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString objectForKey:]: unrecognized selector sent to instance 0x6166490'</p> </blockquote> <p>contains of status is </p> <blockquote> <p>'message': {'code': 0, 'text': 'OK', 'version': '1.1.0'}}</p> </blockquote> <p>What is problem in this? How i correct it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload