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 7036113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:23:07+00:00 2026-05-28T01:23:07+00:00

I am using iOS 5 new feature to parse JSON and I have no

  • 0

I am using iOS 5 new feature to parse JSON and I have no idea that why I am not getting any key value pairs. “aStr” (string representation of data) is putting the right JSON on the output window but I am getting nothing in “dicData” and there is no error either.

Any help is greatly appreciated.

This is what I am using

NSError *error = nil;
    NSData *data = [NSData dataWithContentsOfURL:[NSURL        URLWithString:@"http://www.macscandal.com/?json=get_post&post_id=436"]];

NSString* aStr;
aStr = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];

//NSLog(@"data = %@",aStr);
NSDictionary *dicData = [NSJSONSerialization
                           JSONObjectWithData:data
                           options:NSJSONReadingAllowFragments
                           error:&error];
//NSLog(@"error = %@",error);
NSString *title = [dicData objectForKey:@"title"];
  • 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-28T01:23:07+00:00Added an answer on May 28, 2026 at 1:23 am

    Your JSON is formatted this way:

    {
      "status": "ok",
      "post": {
        "id": 436,
        "type": "post",
        "slug": "foxconn-likely-to-get-assembly-contract-for-apple-tv-set",
        "url": "http:\/\/www.macscandal.com\/index.php\/2011\/12\/28\/foxconn-likely-to-get-assembly-contract-for-apple-tv-set\/",
        "status": "publish",
        "title": "Foxconn Likely to get Assembly Contract for Apple TV Set",
    ...
    

    I haven’t used NSJSONSerialization but just following the natural JSON parsing alg this is how I would try to get it.

    NSDictionary *dicData = [NSJSONSerialization
                               JSONObjectWithData:data
                               options:NSJSONReadingAllowFragments
                               error:&error];
    
    NSDictionary *postData = [dicData objectForKey:@"post"];
    NSString *title = [postData objectForKey:@"title"];
    

    EDIT

    Just a simple check method:

    -(void)check{
    
        NSError *error = nil;
        NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.macscandal.com/?json=get_post&post_id=436"]];
    
        NSDictionary *dicData = [NSJSONSerialization
                                 JSONObjectWithData:data
                                 options:NSJSONReadingAllowFragments
                                 error:&error];
    
        NSDictionary *postData = [dicData objectForKey:@"post"];
        NSString *title = [postData objectForKey:@"title"];
    
        NSLog(@"%@", title);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Im using the new storyboarding features with ios. I have a tab bar which
I recently started a new project using iOS 5 with UIStoryBoards (awesome feature;)). Especially
I have created an application using the new Twitter framework in iOS 5, however
Currently I'm trying to access the files that are transferred using the new iOS
I am using the new Retina display feature of ios 4.0 in my iphone
I have a problem using iOS 5 new functionality to select multiple cells during
I'm using one of the new iOS 5 features for a UIAlertView. I create
I am porting an app that I originally wrote using the accelerometer for IOS
I want to launch the iMessage app (built in new feature for iOS 5)

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.