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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:53:52+00:00 2026-06-14T01:53:52+00:00

NSString *one = [NSDictionary dictionaryWithObjectsAndKeys:@1,@id,@Test1,@text, nil]; NSString *two = [NSDictionary dictionaryWithObjectsAndKeys:@2,@id,@Test2,@text, nil]; NSString *three

  • 0
NSString *one = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"id",@"Test1",@"text", nil];
    NSString *two = [NSDictionary dictionaryWithObjectsAndKeys:@"2",@"id",@"Test2",@"text", nil];
    NSString *three = [NSDictionary dictionaryWithObjectsAndKeys:@"3",@"id",@"Test3",@"text", nil];

    _options = [NSArray arrayWithObjects:one,two,three,nil];

This is the code i am using and running properly in my code. Now i want it dynamically, like

int total = 20;
    NSMutableArray *arr = [[NSMutableArray alloc] init];
    for(int x = 0; x < total; x++)
    {
        [arr addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"1",@"id",@"Test1",@"text", nil]];
    }

But it’s not working. Can anyone help me out of this.

The main code is like

_options = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"1",@"id",@"Test1",@"text", nil],[NSDictionary dictionaryWithObjectsAndKeys:@"1",@"id",@"Test1",@"text", nil],[NSDictionary dictionaryWithObjectsAndKeys:@"1",@"id",@"Test1",@"text", nil],nil];

and i want to create it dynamically ,like the value will go for 1-100. How can i do that

  • 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-14T01:53:53+00:00Added an answer on June 14, 2026 at 1:53 am

    You probably ran into an issue trying to put primitives into the NSDictionary, which isn’t possible. Turn your values into strings.

    for(int x = 1; x <= 100; x++) {
        NSString* object1 = [NSString stringWithFormat:@"%d", x];
        NSString* object3 = [NSString stringWithFormat:@"Test%d", x];
        [arr addObject:[NSDictionary dictionaryWithObjectsAndKeys:object1,@"id",object3,@"text", nil]];
    }
    [_options addObjectsFromArray:arr];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NSMutableArray*array = [[NSMutableArray alloc]init]; NSArray*Somearray = [NSArray arrayWithObjects:1st Object,2ndObject,3rd Object,4th object,5th Object,nil]; In the
i have function with return type as (NSArray/NSData/NSString/NSDictionary and so on). i can return
Thanks for your help on this one. I am pulling a NSDictionary from a
I have the following code: NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@one, @oneKey, @two, @twoKey,
For one NSString, I have N pattern strings. I'd like to extract substrings around
I want to use NSString from one UIView in another UIView . There are
m having this coe....could any one tell me how can i print it on
I'm getting a SIG_ABRT error in the one line within the else of this
I was recently told casting [NSNull null] to (NSString*) was terrible. However, -[NSDictionary stringForKey:]
So I have an NSDictionary where the keys are years as NSString 's and

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.