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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:25:44+00:00 2026-06-09T00:25:44+00:00

I am using a singleton class to fetch JSON from a remote server (via

  • 0

I am using a singleton class to fetch JSON from a remote server (via NSURLConnection) – everything seeme to be fine except when I try to parse the JSON using JSONKit.

Here is some code

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
 [apiData appendData:data];  
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(@"Connection failed! Error - %@ %@",
      [error localizedDescription],
      [[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]);
}

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse   *)response
{
NSHTTPURLResponse *realResponse = (NSHTTPURLResponse *)response;
if (realResponse.statusCode == 200)
{
    apiData = [[NSMutableData alloc] init];
} else {
    NSLog(@"Bad response = %i",realResponse.statusCode);
}
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *jsonData = [[NSString alloc] initWithData:apiData encoding:NSUTF8StringEncoding];
NSDictionary *deserializedData = [jsonData objectFromJSONString];
[self.delegate dataLoaded:deserializedData]; 
}

The error I get is at this line

 NSDictionary *deserializedData = [jsonData objectFromJSONString];

-[__NSCFString objectFromJSONString]: unrecognized selector sent to instance 0x7fc1cd0

Any ideas what is going on here? This seems to be the normal way to parse JSON using JsonKit.

I have already made sure that JSON is valid…Does the string get corrupted somehow during appending in didReceiveResponse?

  • 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-06-09T00:25:46+00:00Added an answer on June 9, 2026 at 12:25 am

    Figured it out… I had JSONKIt.h included in the project but for some weird reason, JSONKit.m was not included in the ‘Compile Sources’ under ‘Build Phases’ – once I added it manually it started working fine.

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

Sidebar

Related Questions

I'm using a singleton class to save all my settings info. It's first utilized
If I have to write a singleton class in C++ I will be using
I have a class that is a singleton. This singleton is instantiated using GCD
In my program, All of my classes are using singleton pattern, except the one
Using a Singleton class guarantees one instance of a class to give control to
I'm using a singleton class for a PostgresSQL connection inside a servelet. The problem
I am using a singleton class to share data between views in my iphone
I'm thinking about using class (singleton) with collections implemented using ConcurrentDictionary. This class will
I have a singleton class that I am using as part of a CAPTCHA
I am using RSpec and want to test the constructor of a Singleton class

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.