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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:50:17+00:00 2026-05-27T09:50:17+00:00

I trie to check if the returned value from objectForKey is not NULL if([[fbResult

  • 0

I trie to check if the returned value from objectForKey is not NULL

if([[fbResult objectForKey:@"current_location"]objectForKey:@"country"])
formViewController.country=[[fbResult objectForKey:@"current_location"]objectForKey:@"country"];

But i have an error on the first line

UPDATE

fbResult is a JSON string,if the user has puted ​​his city and his country in facebook it look like :

 "birthday_date" = "07/*****9";
    "contact_email" = "***mehdi@hotmail.fr";
    "current_location" =     {
        city = Tunis;
        country = Tunisia;
        id = 11166369***;
        name = "Tunis, Tunisia";
        state = Qabis;
        zip = "";
    };
    locale = "fr_FR";
    name = "Mehdi ****el";
    pic = "https://fbcdn-profile-a.akamaihd.net/hprofile-********_s.jpg";
    sex = male;
    uid = 530****;
}

and if the user did not put his country and city it look like :

   { "birthday_date" = "02/*3/19**";
        "contact_email" = "kev**kevin@gmail.com";
        "current_location" = "<null>";
        locale = "fr_FR";
        name = "Aude ***";
        pic = "http://profile.ak.fbcdn.net/hprofile-ak-snc4/4***2_**8_1112_s.jpg";
        sex = female;
        uid = 11***04*;
    }

error is

-[NSObject(NSObject) doesNotRecognizeSelector:] + 96

  • 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-27T09:50:18+00:00Added an answer on May 27, 2026 at 9:50 am

    Checking for existence of an object within a dictionary that is nested in another dictionary is not going to catch all occurrences of bad data.

    To make your code more solid

    id current_location = [fbResult objectForKey:@"current_location"];
    if (current_location != nil && [current_location class] != [NSNull class]) {
    
        id country = [current_location objectForKey:@"country"];
        if (country != nil) {
            formViewController.country= country;
        } else {
            // current_location has no country
        } 
    
    } else {
        // fbResult has no current_location
    }
    

    If the current_location is supposed to be a dictionary you can swap out id currentLocation with NSDictionary * currentLocation

    from your update, your current_location can potentially be an instance of NSNull

    you can check against that with

    [yourObject class] != [NSNull class]

    • 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 Double-Array Trie implementation from http://linux.thai.net/~thep/datrie/datrie.html But I do not
I have an application that starts by loading a large pickled trie (173M) from
I have a prefix trie. What is the recommended schema for representing this structure
I have a trie which I am using to do some string processing. I
I have a text file with Tag - Value format data. I want to
We have the Trie structure to efficiently access data when the key to that
I am trying to implement a Trie in Javascript, which is easy enough but
I have a .diff file but I don't know how to open it. I
I have a specific question regarding the Trie data structure and what is going
I am trying to bind a few WPF controls to a trie. I have

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.