my attempt to init an array with a number of bool values using:
[myArray initWithObjects:[NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES],
开发者_开发问答 nil];
seems to fail since the debugger shows an empty array after this statement is carried out ... Any clues?
Make sure you are alloc
-ing the object, as well, i.e.:
NSArray *myArray = [[NSArray alloc] initWithObjects:...];
...
[myArray release];
Or:
NSArray *myArray = [[[NSArray alloc] initWithObjects:...] autorelease];
Or:
NSArray *myArray = [NSArray arrayWithObjects:...];
精彩评论