• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Method not seeing array as array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Method not seeing array as array


  • Subject: Re: Method not seeing array as array
  • From: Andrew Farmer <email@hidden>
  • Date: Wed, 2 Feb 2005 12:21:23 -0800

On 2 Feb 2005, at 11:31, Michael Swan wrote:
<snip>
@implementation AppController

- (id)init
{
[super init];
channelArray = [[NSMutableArray alloc] init];
masterLevel = 100.0;
maxChannels = 12;
int theTag;
theTag = 0;
//init channels and put into array
//Putting the channelArray code here works for the updateOutput method but not
//for the changeChannelLevel: method
/* this code just makes the app crash still have to figure out the short way
while (theTag < maxChannels) {
channel = [[MSChannel alloc] init];
[channelArray addObject:channel];
NSLog(@"channel %@ added",[channelArray count]);
[channel release];
theTag++;
}
*/


	return self;
}

The standard pattern for an initialization is:
- (id)init
{
	self = [super init]; // <-- note that we're initializing `self' here!
	if(!self) return nil;
	// initialize variables, etc
	return self;
}

I don't know what exactly happens if you don't initialize `self', but your problems are probably stemming from this issue.

Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Method not seeing array as array
      • From: mmalcolm crawford <email@hidden>
    • Re: Method not seeing array as array
      • From: Simon Robins <email@hidden>
    • Re: Method not seeing array as array
      • From: Marco Scheurer <email@hidden>
References: 
 >Method not seeing array as array (From: Michael Swan <email@hidden>)

  • Prev by Date: Patching, upgrading in the future...
  • Next by Date: Re: Method not seeing array as array
  • Previous by thread: Method not seeing array as array
  • Next by thread: Re: Method not seeing array as array
  • Index(es):
    • Date
    • Thread