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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:16:56+00:00 2026-06-05T02:16:56+00:00

I am working with objective c for an iphone app. I see that [dictionary

  • 0

I am working with objective c for an iphone app.

I see that [dictionary objectForKey:@"key"] return <null>. Doing a if([dictionary objectForKey:@"key"] == nil || [dictionary objectForKey:@"key"] == null) does not seem to catch this case.

Doing a if([[dictionary objectForKey:@"key"] isEqualToString:@"<null>"]) causes my program to crash.

What is the correct expression to catch <null>?

More Details
An if statement for nil still isn’t catching the case… Maybe i’m just too tired to see something, but here’s additional info:

Dictionary is populated via a url that contains json data like so:

NSURL *url = [NSURL URLWithString:"http://site.com/"];

dataresult = [NSData dataWithContentsOfURL:url];

NSError *error;
NSMutableDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:dataresult options:kNilOptions error:&    error];

doing an NSLog on the dictionary gives this output:

{
    key = "<null>";
    responseMessage = "The email / registration code combination is incorrect";
}
  • 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-05T02:16:57+00:00Added an answer on June 5, 2026 at 2:16 am

    You have an instance of NSNull. Actually, the instance, since it’s a singleton.

    Cocoa collections can’t contain nil, although they may return nil if you try to access something which isn’t present.

    However, sometimes it’s valuable for a program to store a thing meaning “nothing” in a collection. That’s what NSNull is for.

    As it happens, JSON can represent null objects. So, when converting JSON to a Cocoa collection, those null objects get translated into the NSNull object.

    When Cocoa formats a string with a “%@” specifier, a nil value will get formatted as “(null)” with parentheses. An NSNull value will get formatted as “<null>” with angle brackets.

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

Sidebar

Related Questions

I am working on an iPhone app which needs a scroll view that populates
Me and a friend are going to be working on an iPhone app that
I'm working on an iPhone app in objective-c also using cocos2d for graphics. I
I'm working on a mobile website which is NOT a native iPhone app but
I'm working on an iPhone app using objective C. I've got class A, which
I'm working on an iPhone App that's HTML5/JS displayed in a single UI Webview.
I'm working on an iPhone-iPad app with Objective-C. I need to get the Bonjour
I am working on an iPhone app that will construct, at run-time, an NSMutableDictionary
I am working on a simple app in objective-C that uses RSA Algorithm .
I am working on my first Objective-C app for iOS and am having an

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.