ios - getting error when calling objectFromJSONString using JSONKit -


i use following code create dictionary based on json string received server. (i have downloaded jsonkit , embedded project). code below returns legal json string server (parsed on android) crashes when try convert dictionary.

- (ibaction)submit { bool usessl = true; char *c_url="http://(rest of url)";   nsstring* url = [nsstring stringwithformat:@"%s" , c_url]; url = [nsstring stringwithformat:@"%@%@%s", url, self.label.text, "/keys"]; nsstring * response = [self getdatafrom:url];   nsdictionary *dict = [response objectfromjsonstring]; //generates sigabrt!! nslog(@"%@",dict);   nsstring *success = [dict valueforkey:@"success"];  }     - (nsstring *) getdatafrom:(nsstring *)url{ nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request sethttpmethod:@"get"]; [request seturl:[nsurl urlwithstring:url]];  nserror *error = [[nserror alloc] init]; nshttpurlresponse *responsecode = nil;  nsdata *oresponsedata = [nsurlconnection sendsynchronousrequest:request returningresponse:&responsecode error:&error];  if([responsecode statuscode] != 200){     nslog(@"error getting %@, http status code %i", url, [responsecode statuscode]);     return nil; }  return [[nsstring alloc] initwithdata:oresponsedata encoding:nsutf8stringencoding];  } 

thanks, simon

found answer here. answer says: "figured out... had jsonkit.h included in project weird reason, jsonkit.m not included in 'compile sources' under 'build phases' - once added manually started working fine."


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -