Iphone release problem

Posted by xger86x on Stack Overflow See other posts from Stack Overflow or by xger86x
Published on 2011-01-11T22:14:04Z Indexed on 2011/01/11 23:53 UTC
Read the original article Hit count: 170

Filed under:
|

Hi,

i have the following code in a .h

@property (nonatomic, copy) NSString *username;

Then, username is assigned in this way when the user enter text in a TextField:

self.username = textField.text;

And then, in dealloc method i call release:

NSLog(@"%d",[username retainCount]);
[username release];
NSLog(@"%d",[username retainCount]);

But in the console it prints:

2011-01-11 23:09:52.468 IApp[2527:307] 1
2011-01-11 23:09:52.480 IApp[2527:307] 1

What is the problem?

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-management