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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:43:45+00:00 2026-06-08T08:43:45+00:00

I am trying to retrieve the values from my NSDictionary however I am running

  • 0

I am trying to retrieve the values from my NSDictionary however I am running into errors, I was wondering if someone might be able to help me with my solution.

I have 18 values, not all are shown here that I am checking, when the correct key is reached I would like to take the value in the NSDictionary and pass it into one of my NSString variables.

Below is an example of what I am trying to do however like I say I am having several issues

for (id key in searchData) {
    if ([[searchData objectForKey:key] isEqualToString:@"Code"]) {
        codeSeries = [searchData objectForKey:key];
    }
    else if ([[searchData objectForKey:key] isEqualToString:@"ID"]) {
        IDSeries = [searchData objectForKey:key];
    }

    // ...

However, when I try to log out any of the values, they all return Null. I have checked the dictionary before hand and the values are all most definitely in there, so I am thinking there is something wrong with my code above.

Any help would be greatly appreciated.

Update

This is how I create the NSDictionary

//start of mymethod...

NSDictionary *sendSeriesDictionary = [[NSDictionary alloc] init];
    
    // Keys for sendSeriesDictionary
    NSArray *keys = [NSArray arrayWithObjects:@"Code", @"ID", nil];
    
    // Objects for keys that are for sendSeriesDictionary
    NSArray *objects = [NSArray arrayWithObjects: [NSNull null], IdString, nil];
    
    // Add keys and objects to NSDictionary
    sendSeriesDictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];


[engineRequests SeriesSearch:sendSeriesDictionary]; // this is where I send the NSDictionary over to where I want to read it.

//end of mymethod
  • 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-08T08:43:47+00:00Added an answer on June 8, 2026 at 8:43 am

    You’ve got several problems. First, you mix up keys and values (like Tom said). Second, you have a possible memory leak where you create the dictionary, or at least a unnecessary instantiation.

    Try this for creating the dictionary:

    // Keys for sendSeriesDictionary
    NSArray *keys = [NSArray arrayWithObjects:@"Code", @"ID", nil];
    
    // Objects for keys that are for sendSeriesDictionary
    NSArray *objects = [NSArray arrayWithObjects: [NSNull null], IdString, nil];
    
    // Add keys and objects to NSDictionary
    NSDictionary *sendSeriesDictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
    

    Retrieving the values can be done like this:

    codeSeries = [searchData objectForKey:@"Code"];
    IDSeries = [searchData objectForKey:@"ID"];
    

    In your first loop you looped through all the keys, got their values and then compared those to the key again. Which makes no sense.

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

Sidebar

Related Questions

Im trying to retrieve the values from MySQL database and convert it into int
Hi I am trying to retrieve values from database. I have a row which
I am trying to retrieve the values from the following url: http://rentopoly.com/ajax.php?query=Bo . I
I am trying to retrieve some values from the registry. Here is the full
Using PHP. I'm trying to retrieve $_POST values from a the second dimension of
I am trying to save some values from my app using NSCoding. I'm able
I'm having some issues trying to retrieve unique values from a DataSet in csharp,
I am trying to retrieve query string values from a url. And the app
I am trying to retrieve a set of values from database and assigned it
I'm trying to retrieve values from an XML file and I find some values

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.