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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:29:38+00:00 2026-06-04T05:29:38+00:00

Could you tell me please, how can I make something like this: For example

  • 0

Could you tell me please, how can I make something like this:

For example I have an app which contains info about your pets. But firstly, you should add a pet to a database. In a special view, you enter your pet’s name, age, breed, color and etc (keys) and then you save it. Here we are, now you have your first pet in the app. But then you wanna add new pets…

How can I save all these dictionaries with same keys ? You don’t know how may dictionaries to create because you don’t know how many pets an user wanna add in the app. What is the easiest way?

What if user wants to add like thousands of pets in the app ? I am sure, I shouldn’t create thousands of dictionaries in the code for every possible animal. But how do I do that ?
Like dictionary1 for Deisy, dictionary2 for Bruno, dictionary3 for Hamlet and etc.

  • 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-04T05:29:40+00:00Added an answer on June 4, 2026 at 5:29 am

    Here is a rough description of how it could work:

    Somewhere you need to define a collection to hold that pets.

    NSMutableSet *myPets = [[NSMutableSet alloc] init];
    

    When the user has entered the data and presses the save button, some method is called in your view controller. Within that method you collect the data, like this:

    NSDictionary *pet = [NSDictionary dictionaryWithObjectsAndKeys:nameField.text, @"name", breedField.text,@"breed", nil];
    [myPets addObject:pet];
    

    At this point the pet has been put into the myPets NSMutableSet and the compiler will release it, so it doesn’t exist anymore. The next time the user enters data and presses the button again, a new pet will be created and put into myPets. Don’t worry about millions of instances being created, the compiler will take care of it.

    If you want to retrieve individual pets afterwards, you can do something like this

    for (NSDictionary *aPet in myPets) {
       if ([[aPet objectForKey:@"name"] isEqualToString:@"Lassie"]) {
          // do what you want to do with Lassie
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please tell me how I can make the icon for my app
Could you please tell, if something like this: db.subscribers.find({ LISTID: 59, {$and : [
Could you please tell me how I can make RequestFactory populate fields of my
Could you guys please tell me how I can make the following code more
Could you please tell me how can one escape an apostrophe. I need it
Could anyone please tell me why the following line about filter init method invocation
Could you please tell me how do I go about pausing my program for
Can you please tell me how can I make a simple connection with remote
I am trying to make decision how to design my app. I have about
Could you please tell me how this photo animation effect is achieved - see

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.