I have a class level NSMutableDictionary object that I need to initialize, and reinitialize. Since my project is ARC, I am not sure if I can use release.
What is correct way to do it?
My current code results into a crash:
myDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys: value1,@"key1",
value2,@"key2", nil];
Note that this crash is when I do this 2nd time after class is loaded, not the first time. So the problem is definitely that I am re-allocating it.
In any case (crash or not), I want a leak-free way to handle this in an ARC project.
I think you need to do like that
when you re using it please do not alloc/init again instead you can do as following
and set again value inside the dictionary