So I did that thing with Xcode where you say analyze and it finds leaks and stuff and here, it says that I am leaking (marked in code below).
// Copy dictionary to memory
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"DataCategoriesDictionary" ofType:@"plist"];
NSDictionary *dataCategoriesDictionary = [[NSDictionary alloc] initWithContentsOfFile:filepath];
self.choices = [[NSMutableDictionary alloc] initWithDictionary:[dataCategoriesDictionary objectForKey:self.chosenCategory]]; // LINE 55
[dataCategoriesDictionary release]; // HERE, the compiler says "Potential leak of an object allocated on line 55"
Even though it doesn’t make any sense that I could be leaking a instance variable, I tried adding a release statement for it anyway and Xcode still gave me the same error. What else could I be leaking?
If choices is a property with retain you are leaking the NSMutableDictionary.
Either autorelease or use a temporary.
or (my favorite)
or