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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:45+00:00 2026-06-10T13:15:45+00:00

How can we identify the object is available for a particular key. I have

  • 0

How can we identify the object is available for a particular key. I have tried following:

for(NSDictionary *item in jsonArray){
if([item objectForKey:@"EventDate"])
        NSLog([item objectForKey:@"EventDate"]);
}

This is getting crash the code with error:

  -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x6a567b0

I have also find many posts that is showing objectForKey will return nil if a key doesn’t exists. Than my question is there is also a method in NSDictionary class that is “setNilValueForKey”. How is this possible that we cannot specify the NSDictionary key with nil object and also we have the method to set nil value for object in NSDictionary.

Please Suggest on first and also make me clear on second query.

  • 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-10T13:15:46+00:00Added an answer on June 10, 2026 at 1:15 pm

    1) Your jsonArray contains other types of objects than NSDictionaries, including at least one NSString. NSString doesn’t respond to objectForKey: so it throws an exception when you try to call it. You’ll have to look at the JSON to determine how to proceed with whatever you were doing.

    2) There is an NSObject method setNilValueForKey: which is related to key-value coding. This isn’t really related to NSDictionary. If you really need to represent nil in your dictionary, set [NSNull null] as the object for your key that represents nil.

    Hope this helps!

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

Sidebar

Related Questions

I can't identify the object being deallocated, I run my app with Command+Y but
How can I identify the datas that have anything else than a number in
I can use GetHashCode() to identify an object but is there any way to
I have 82 .csv files, each of them a zoo object, with the following
Does JVM manage any special attribute for singleton object? How can I identify that
Possible Duplicate: In javascript how can we identify whether an object is a Hash
I just learned that an object can have only one ID, so I'm not
I'm trying to design an application that can identify COM objects and their properties
What is the use of GetHashCode() ? Can I trace object identity using GetHashCode()
I Want to develop a app which can identify corporate email accounts and when

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.