Hi everyone !
There's something i don't seem to get about properties and memory management with iOS !
In my AppDelegate, i want a NSString * property :
- i've declared it this way in the .h file : @property (nonatomic, copy) NSString *myString;
- and synthetized it in the .m
One of my method use the property like this :
myString = [notificationDictionary objectForKey:@"myKey"];
(notificationDictionary being the NSDictionary * I got in the application:didFinishLaunchingWithOptions:'s launchOptions dictionary with the key UIApplicationLaunchOptionsRemoteNotificationKey)
I think that means that my AppDelegate owns its own copy of myString with a retain count to 1, right ?
Then another method tries to access the property, but I get an EXC_BAD_ACCESS exception.
To be 100% sure of what was going on, I've retained my property many times and displayed the value of its retain count at each access : the retain count is decremented somewhere between the method where I give a value to my property and the method where I read it.
Which object sent the release method to my string ?