@property(nonatomic, retain) NSString *password;
-(id)init {
...
password=[NSString stringWithFormat:@"%@", [[NSProcessInfo processInfo] globallyUniqueString]];
OR
password=[[NSProcessInfo processInfo] globallyUniqueString];
}
My problem is that during course of execution at some random point the password object gets automatically released. Effect is same when i use either of the assignments. As soon as i put in a retain, the problem no longer exists. I’m sure there is no release of password object anywhere in the flow – as i mentioned it is in a singleton class. I also checked that the class instance is same even when the password object is released.
Any hints please!
You assign the iVar, not the property…
So as you don’t use the setter method, your object is not retained.
Use the property instead: