Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7659357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:19:20+00:00 2026-05-31T13:19:20+00:00

I’m trying to use NSJSONSerialization for retrieving JSON data, the problem is that I

  • 0

I’m trying to use NSJSONSerialization for retrieving JSON data, the problem is that I can not parse correctly the NSDictionary.

The webservice returns the following:

[{“Status”:”No variables”}]

My code looks like this:

...
NSURL * url = [NSURL URLWithString:@"http://justforexamplepurposes.xyz/file.php"];
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[[NSString stringWithFormat:@"username=%@&password=%@", username, password] dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse * response = nil;
NSError * error = nil;
NSData * result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if(error == nil && result != nil)
{
    NSError * json_error = nil;
    id id_json_serialization = [NSJSONSerialization JSONObjectWithData:result options:NSJSONReadingMutableContainers error:&json_error];
    if(json_error == nil)
    {
        NSDictionary * dictionary_result = (NSDictionary *) id_json_serialization;
        NSLog(@"|>%@<|", dictionary_result);
        NSEnumerator * enume;
        id key;
        enume = [dictionary_result keyEnumerator];
        while((key =[enume nextObject]))
        {
            NSLog(@"%@ : %@", key, [dictionary_result objectForKey:key]);
        }
    }
}
...

The first NSLog is printed correctly:

|>(
{
Status = “No variables”;
} )<|

But at the second NSLog, it throws an Exception:

2012-03-17 13:57:22.195 TESTAPP[41072:f803] -[__NSArrayM
keyEnumerator]: unrecognized selector sent to instance 0x689a9f0
2012-03-17 13:57:22.196 TESTAPP[41072:f803] * Terminating app due to
uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSArrayM
keyEnumerator]: unrecognized selector sent to instance 0x689a9f0’
*
First throw call stack: (0x13e9022 0x157acd6 0x13eacbd 0x134fed0 0x134fcb2 0x2a80 0x13eae99 0x3614e 0x360e6 0xdcade 0xdcfa7 0xdc266
0x5b3c0 0x5b5e6 0x41dc4 0x35634 0x12d3ef5 0x13bd195 0x1321ff2
0x13208da 0x131fd84 0x131fc9b 0x12d27d8 0x12d288a 0x33626 0x232d
0x2295) terminate called throwing an exception(lldb)

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:19:21+00:00Added an answer on May 31, 2026 at 1:19 pm

    The JSON that the server is returning actually an array with just one object in it. So your variable dictionary_result is actually an NSMutableArray.

    Quick tip: if you use CFShow(dictionary_result) rather than NSLog(@"|>%@<|", dictionary_result);, you might have spotted this, as CFShow gives you a lot more information about your object, including type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.