NSMutableArray count method show the NSMutableArray is count 0?

Posted by Tattat on Stack Overflow See other posts from Stack Overflow or by Tattat
Published on 2010-04-11T09:42:12Z Indexed on 2010/04/11 9:53 UTC
Read the original article Hit count: 434

This is my init method:

-(id)init{

    self = [super init];
    magicNumber = 8;

    myMagicArray = [[NSMutableArray alloc] initWithCapacity:(magicNumber*magicNumber)];
    NSLog(@"this is the magic Array: %d", [myMagicArray count]);

    return self;
}

This is the .h:

@interface Magic : NSObject {
    NSMutableArray *myMagicArray;
    int magicNumber;

}

The console shows me that number is 0. instead of 64, wt's happen? I already check out this post:

StackOverflow Link: http://stackoverflow.com/questions/633699/nsmutablearray-count-always-returns-zero

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about nsmutablearray