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

  • Home
  • SEARCH
  • 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 138575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:17:09+00:00 2026-05-11T07:17:09+00:00

I am learning Objective-C and have hit a snag. I have created a custom

  • 0

I am learning Objective-C and have hit a snag.

I have created a custom object called ‘Baddie’. I am trying to add the object to a couple of mutable arrays.

Baddie *b1 = [[Baddie alloc]initWithTag:4444 pos:cpv(450,270) dir:cpv(0,1)];  [baddieArray addObject: b1];     [baddieWaitingArray addObject: [[Baddie alloc]initWithTag:4447 pos:cpv(450,270) dir:cpv(0,1)]]; [baddieWaitingArray addObject: [[Baddie alloc]initWithTag:4448 pos:cpv(450,270) dir:cpv(0,1)]];     //end 

At ‘end’ both arrays appear to be empty. The arrays were previously initialised as follows:

baddieArray = [[NSMutableArray alloc] init]; baddieWaitingArray = [[NSMutableArray alloc] init]; 

I’m not sure why the arrays are empty. The pointer to b1 is still pointing to the object. I can still retrieve properties from it. Where have I gone wrong?

  • 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. 2026-05-11T07:17:09+00:00Added an answer on May 11, 2026 at 7:17 am

    This seems too simple, but if baddieArray is nil, then the adds will be ignored and querying its size will return zero.

    I realize that you show reasonable allocation for the arrays, but could something have happened to them after that point?

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

Sidebar

Related Questions

I'm learning Objective-C, and have a C/C++ background. In object-oriented C++, you always need
I'm learning objective-C and Cocoa and have come across this statement: The Cocoa frameworks
I have just started learning objective-C and the iphone sdk and I have a
I'm learning Objective-C at the moment and have come across optional methods in Protocols.
I'm learning Objective-C using GNUStep in my Windows(Cygwin) and i have two files, one
Since I started learning Objective-C and Cocoa, I've been wondering why they have chosen
I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck
I'm learning Objective-C using GNUstep, because I don't have a Mac and the GNUstep
I just started learning Objective-C and OOP ... so I have very stupid question
I'm learning objective-c and keep bumping into the @ symbol. It is used in

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.