Iphone发布问题

xge*_*86x 1 iphone memory-management

我在.h中有以下代码

@property (nonatomic, copy) NSString *username;
Run Code Online (Sandbox Code Playgroud)

然后,当用户在TextField中输入文本时,以这种方式分配用户名:

self.username = textField.text;
Run Code Online (Sandbox Code Playgroud)

然后,在dealloc方法中我调用release:

NSLog(@"%d",[username retainCount]);
[username release];
NSLog(@"%d",[username retainCount]);
Run Code Online (Sandbox Code Playgroud)

但在控制台中它打印:

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

问题是什么?

谢谢

Kri*_*ael 6

释放后,对象被销毁,因此第二次调用'retaincount'具有未定义的行为