Note that there are some explanatory texts on larger screens.

plurals
  1. POxcode JSON trouble
    primarykey
    data
    text
    <p>I have a problem with this code right here:</p> <pre><code>- (void)fetchedData:(NSData *)responseData { //parse out the json data NSError* error; NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&amp;error]; NSArray* announcements = [json objectForKey:@"clients"]; NSLog(@"laag 1: %@", announcements); NSDictionary* announcement = [announcements objectAtIndex:0]; NSNumber *status = [announcement objectForKey:@"status"]; humanReadble.text = [NSString stringWithFormat:@"%@", status]; } </code></pre> <p>I'm trying to fetch JSON data from <a href="http://rs-hosting.nl/panel/serverstatus_json.php" rel="nofollow">this</a> URL. I know the fetching works, the NSLog displays it fine, but the problem begins at the NSDictionary. I did some tests with breakpoints and found that the error was there. This is a overview of my log:</p> <pre><code>2012-03-20 23:15:13.210 Json test 2[13248:f803] laag 1: { client = ( { companyname = xxx; datecreated = "2012-03-11"; email = "xxxx"; firstname = xxx; groupid = 0; id = 3; lastname = O; status = Active; }, { companyname = "xxx"; datecreated = "2012-03-02"; email = "xxx"; firstname = xxx; groupid = 0; id = 1; lastname = "xxx"; status = Active; }, { companyname = ""; datecreated = "2012-03-08"; email = "xxx"; firstname = xxx; groupid = 0; id = 2; lastname = xxx; status = Active; }, { companyname = xxx; datecreated = "2012-03-13"; email = "xxx"; firstname = xxx; groupid = 0; id = 4; lastname = "xxx"; status = Active; } ); } 2012-03-20 23:15:13.212 Json test 2[13248:f803] -[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x6821f30 2012-03-20 23:15:13.213 Json test 2[13248:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x6821f30' *** First throw call stack: (0x13c7022 0x1558cd6 0x13c8cbd 0x132ded0 0x132dcb2 0x21a2 0x13c8e42 0x9379df 0x139b94f 0x12feb43 0x12fe424 0x12fdd84 0x12fdc9b 0x12b07d8 0x12b088a 0x11626 0x1c3d 0x1ba5) terminate called throwing an exception(lldb) </code></pre> <p>Can someone please help me out?</p> <p>I use sdk 5.1, xcode 4.3 on lion 10.7.3</p>
    singulars
    1. This table or related slice is empty.
    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.
    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