Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ATG

macrumors regular
Original poster
Aug 7, 2005
187
0
I'm getting a very weird error here:

Code:
datasourceArray = [[NSArray alloc] initWithObjects:@"Some", @"Items", @"That", @"Go", @"In", @"The", @"Sourcelist"];

That line is giving a signal 11 (SIGSEGV). I know it's that line because I've put NSLogs around the line and only the first appeared and I've commented it out and I didn't get an error.

Even odder is that I've got exactly the same line in -initWithType:error: and it goes fine (this is in -init)

datasourceArray is an IV BTW.

Am I doing something incredibly stupid?
 
Did you read the documentation? It makes it very, very clear what you are doing wrong. As you are not passing a count NSArray has no way of knowing how many objects you are passing. So you have to pass an additional nil to terminate the list like this:

Code:
NSArray *myArray = [[NSArray alloc] initWithObjects:@"I",@"should",@"read",@"the",@"docs",nil];
 
robbieDuncan...

What do you do for a living? You say you don't often write code for the mac...
 
What do you do for a living? You say you don't often write code for the mac...

I am a professional programmer! I work for Citigroup in London developing internal applications for the middle office. We mostly use SQL (Sybase flavour) with shell scripts, Perl, Java and a very tiny amount of C++. I write Cocoa stuff at home when I have spare time.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.