I'm new to iPhone developement and I did a lot of reading before jumping into my first app. All this reading made me understand that correct memory management is a big deal, so I want to do things right.
I've just finished my first app and started testing it for leaks. There were plenty :) I've changed the code to solve the leaks and then started getting BAD_ACCESS exceptions. Now to my questions:
I have a UITextView object, let's call it 'utv'. I saw that its 'text' field is defined as follows:
@property (nonatomic, copy) NSString* text;
If I write the following line of code:
utv.text = [NSString stringWithString:@"Blabla"];
I shouldn't be concerned about the autorelease pool releasing the string, right? Because it uses copy?
What if it was defined as
@property (nonatomic, retain) NSString* text;
Should I still not be concerned about the autorelease pool, becuase the retain raised the refernce count by 1?
Can I know when the autorealease pool will release a string I create with stringWithString instead of initWithString?
Thanks! Eli