Reputation: 1365
I don't understand why if I write these code
icons = [[NSArray alloc] initWithObjects:
@"appointment",
@"work",
@"anniversary",
@"me",
nil];
the app crashed. But then I replaced by these code
icons = [NSArray alloc] arrayWithObjects:
@"appointment",
@"work",
@"anniversary",
@"me",
nil];
and the app did't crash. But there is the same affect between these methods ! I don't know why ? Can u help me ?
Upvotes: 2
Views: 1176
Reputation: 264
initWithObjects method means you have to release the object of array whenever this is not required as this is instance method and for more details click:
arrayWithObjects method means you don't need to release the object of array whenever this is not required as this is class method and for more details click:
If you are not clear with the points so revert me..
Upvotes: 1