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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:31:50+00:00 2026-06-14T21:31:50+00:00

I am write a Objective-C Code on XCode 4.4. I have a NSMutableArray as

  • 0

I am write a Objective-C Code on XCode 4.4.
I have a NSMutableArray as a instance variable of my class k_info
I have defined and synthesized (nonatomic,retain) property by the name of onesplaces too.
I am unable to add a NSMUtableString object in the NSMutableArray onesplaces.
When I try to add it.The size of onesplaces remains 0 and object at zero index obviously remains null.
I tried doing this with and without using “self” key-word but it didnt worked in either case.
My syntax of adding object and printing it is right because when I create a new NSMutableArray test
and try to do the same thing it works for it but not for the instance variable onesplaces.
I cannot proceed any further in my project without solving this issue.please tell me why is it
happening and how should I solve this problem.

-(void)createinfo:(NSMutableArray )al varsis:(int)vars
{
NSMutableString
stes=[[NSMutableString alloc]init];
stes=(NSMutableString*)@”string0″;

  [ onesplaces addObject:stes];
  NSLog(@"%u",[onesplaces count]);
  NSLog(@"value is: %@ ",[ onesplaces objectAtIndex:0]);

  [ self.onesplaces addObject:stes];
   NSLog(@"%u",[onesplaces count]);
   NSLog(@"value is: %@ ",[self.onesplaces objectAtIndex:0]);

  NSMutableArray* test=[[NSMutableArray alloc]init];
  [ test addObject:stes];
   NSLog(@"%u",[test count]);
  NSLog(@"value is: %@ ",[test objectAtIndex:0]);

}
  • 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-14T21:31:51+00:00Added an answer on June 14, 2026 at 9:31 pm

    You probably forgot to create the array. Somewhere in your code, maybe in your init method, you need to create the array before using it.

    self.onesplaces = [[NSMutableArray alloc] init];
    

    You get nil instead of error messages because Objective-C allows you to send messages to nil, which always return nil.

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

Sidebar

Related Questions

I would like to write some Objective-C code for distribution. What is the best
I can write my code in both the ways to achieve my objective, but
I'm trying to write an Objective C class which draws an OpenGL polygon. I've
I have recently started to learn Objective-C and write my tests using OCUnit that
I have see this in sample objective c code before, but can't find it
I created my app using StoryBoard. Then, I added objective-c class to have .h
I'd like to write an Objective-C class without Cocoa or GNU's Object.h (for educational
I am just trying to write my very first code in Objective C. I
I have a set of enum values defined in the Foo class (below). namespace
while typing in Xcode, (objective - c for iPhone dev) Suppose I write [mySprite

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.