Instantiating NSMutableArrays? ARC?


Having just gone through chapter 1, I kept getting SIGABRT crashes when trying to build the app. My code appeared identical to that in the book and I recreated the project three times with no success. I then downloaded the source and compared, and found out that the way the two NSMutableArrays are instantiated in the author’s code are different than what the book shows.

In the book:

questions = [[NSMutableArray alloc] init]; answers = [[NSMutableArray alloc] init];

In the author’s code:

questions = [NSMutableArray array]; answers = [NSMutableArray array];

When I changed my code to the above it compiled and ran fine. Can someone please explain the difference? Do you ever have to alloc/init if using ARC, and are more examples in the book similar to this (written one way in the book, another way in the code)? I am using Xcode 4.3.3 on Lion 10.7.4.