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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:08:28+00:00 2026-06-04T19:08:28+00:00

I create two NSMutableDictionary : dictionary1 and dictionary2. In the first dictionary I store

  • 0

I create two NSMutableDictionary: dictionary1 and dictionary2. In the first dictionary I store some array object having there keys. And in the second dictionary I store the object of first dictionary with the key like this:

int page = 1;
[dictionary2 setObject:dictionary1 forKey:[NSString stringWithFormat:@"%d",page]];
[dictionary1 removeAllObjects];

but at the time of retrieve of the object i do like this

dictionary1 = [dictionary2 valueForKey:[NSString stringWithFormat:@"%d",page]];
NSLog(@"dictionary1 %@", dictionary1);`

Then it gives null value. I don’t know what mistake I do.

  • 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-04T19:08:30+00:00Added an answer on June 4, 2026 at 7:08 pm

    After you add dictionary1 to dictionary2, you are removing all of the objects.

    This is the same dictionary that is in dictionary2 (it does not create a copy), therefore you are removing the objects from it as well.

    You need to remove the line [dictionary1 removeAllObjects];.

    Then, since you are done with dictionary1 at this point, you can either remove the reference to it or set to a nice new shiny dictionary which is ready to use:

    // Remove the reference
    dictionary1 = nil;
    
    // Or, create a new, empty dictionary
    dictionary1 = [[NSDictionary alloc] init];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create two application, let say my first application called mastersite, and the second
Create two tables with some ids overlapping. create table outer_table ( id integer, overlap_in
I'm trying to create two buttons that using the hover event, hide some divs
I am going to create two pages. The first page will be home.html On
I try create two moving object from one class. I want to control they
I could create two ajax requests, but I'm wondering if there is an easy
I'm having issues with a singleton I've created. It contains two NSMutableDictionary's, which are
I'm trying to create two a regex to add quotes to some values in
I want to create two dimension array of different type like I can add
SETUP I have an NSMutableDictionary of NSMutableDictionaries. I create a dictionary of searched for

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.