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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:36:08+00:00 2026-05-17T00:36:08+00:00

i have a dictionary of array: array3 = [[NSDictionary dictionaryWithContentsOfFile:docpath2] retain]; no problem here.

  • 0

i have a dictionary of array:

    array3 = [[NSDictionary dictionaryWithContentsOfFile:docpath2] retain]; 

no problem here. now i have
an NSString *temp which contains some numbers.
i would like to check whether this number exist in the dictionary, not each array.

    if([array3 valueForKey:temp])

is this right? doesn’t the if loop execute if its true?

<dict>
     <key>123456</key>
     <array>
        <string>low</string>
        <string>High</string>
     </array>
      <key>78910</key>
    <array>
         <string>low</string>
         <string>High</string>
     </array>
  </dict>

for example temp = 78910, i would like it to be found.

thks in adv

  • 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-17T00:36:09+00:00Added an answer on May 17, 2026 at 12:36 am

    Not sure I get your question, but I’ll give it a shot.

    First, objectForKey: is the method to use as valueForKey: is for Key-Value Coding and will give you strange results should your key start with an @.

    Then, if objectForKey: does return a pointer (i.e. the return value is not nil/NULL/0) then the key exists and has a value (which was returned). So yes, you can do:

    if ([array3 objectForKey:temp]) {
      // Do something, the dictionary does contain a value for
      // the key referenced by "temp".
    }
    

    Now, if your keys a strings like @"123", then you can of course do [array3 objectForKey:@"123"]. But if you got an integer, then you would need to do [array3 objectForKey:[NSString stringWithFormat:@"%d", 123]].

    Also note that you can also use NSNumber or NSValue as keys. So you could do:

    [myMutableDictionary setObject:someObject forKey:[NSNumber numberWithInt:123]];
    myValue = [myMutableDictionary objectForKey:[NSNumber numberWithInt:123]];
    if (myValue) {
      // Do something.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plist file which contains an array of dictionaries. Here is one
I have an array of NSDictionary. NSDictionary* dictionary = [NSDictionary dictionaryWithObjects:bothUserName forKeys:bothUID]; // here
I have a plist file which is an array of dictionaries. Where each dictionary
O have an NSDictionary. Inside the dictionary there is an array. I want to
I have an NSArray of NSDictionary . Each dictionary in the array has three
Does VBA have dictionary structure? Like key<>value array?
I have an Array of NSDictionary objects. These Dictionaries are parsed from a JSON
I have a array with nested dictionary data like this: [{ link : [
I have an array of custom objects. The objects includes a dictionary. Something like
I have an array of dictionary with only one entry in the dictionary. ___

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.