I have a NSString declared in the interface part:
@property (nonatomic, retain) NSString *filePath;
In viewDidLoad I give this a value and when I am trying to call it from one of my custom methods it works for the first time but on the second it crushes. In my opinion filePath was autoreleased during the first call.
I tried a different approach, in my method I have done something like this:
NSString *path = [[[NSString init] alloc] autorelease]; path = [filePath copy];
and this time seems to work, but when checking the retainCount of path it is constantly increasing. The first time the method is called, retainCount is 4 but for the second is 2, third is 3 and so on.
Ok, I understand for filePath to be increasing, because of [copy] but why also for path variable? And why in the first case it didn't worked?