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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:21:11+00:00 2026-05-20T21:21:11+00:00

I am very new to Objective-C with Cocoa, and I need help. I have

  • 0

I am very new to Objective-C with Cocoa, and I need help.

I have a for statement in which I loop i from 1 to 18, and I would like to add an object to an NSMutableArray in this loop. Right now I have:

chapterList = [[NSMutableArray alloc] initWithCapacity:18];
for (int i = 1; i<19; i++)
{
    [chapterList addObject:@"Chapter"+ i];
}

I would like it to add the objects, chapter 1, chapter 2, chapter 3… , chapter 18. I have no idea how to do this, or even if it is possible. Is there a better way? Please Help

Thanks in advance,

  • 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-20T21:21:11+00:00Added an answer on May 20, 2026 at 9:21 pm

    Try:

    [chapterList addObject:[NSString stringWithFormat:@"Chapter %d", i]];
    

    In Objective-C/Cocoa you can’t append to a string using the + operator. You either have to use things like stringWithFormat: to build the complete string that you want, or things like stringByAppendingString: to append data to an existing string. The NSString reference might be a useful place to start.

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

Sidebar

Related Questions

I'm very new to Objective-C and Cocoa but I've made a simple app which
I'm very new to Objective-C and have just made my first app from scratch.
I'm very new to Objective-C, and am having some beginner issues. I have an
please help me, i'm very new in objective-c i've got 2 simplest classes (bellow
I am very new to objective-c and having a problem to initialize an object
First of all, I am a a very new Objective C/Cocoa iOS Developer but
I am very new to Cocoa and Objective C so please forgive me if
I am very new to Objective-C. Here is what I want. I have a
I'm very new to Objective-C, and am having some beginner issues. I have an
I'm very new to objective C. I followed the tutorial for integrating Facebook to

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.