Rap*_*eta 1 cocoa cocoa-touch memory-management objective-c manual-retain-release
使用Objective-C时是否有任何经验法则可以帮助我了解何时是发布变量的正确时机?
Dav*_*ong 11
NARC!:)
If you invoked a method that contains N ew, A lloc, R etain, or C opy, then you must release or autorelease. Otherwise you don't touch it.
Of course, anything the documentation explicitly says trumps this rule.
The other thing is that when you're dealing with C function the NARC rule still applies, but also gets the Create rule: if the function contains "create", then you're responsible for CFReleasing or freeing the returned data.
| 归档时间: |
|
| 查看次数: |
430 次 |
| 最近记录: |