目标C-[super dealloc]旧吗? [英] Objective C - [super dealloc] old?
问题描述
我希望每个人都能理解我.
谢谢.
iOS上有一个名为ARC的新系统,该系统会自动将释放/保留/解除分配等消息发送到您的对象.您可能会在此处了解更多信息
回答问题时要注意的重要事项是ARC是可选的.您可以使用它,但不必这样做. (在创建新的XCode项目时,您可以勾选启用自动引用计数"按钮,也可以不勾选.)
因此,要回答您的问题:如果在项目中使用ARC,是的,不再需要dealloc
.如果您不使用ARC,则仍然需要管理自己的内存.这取决于您如何设置项目.
i have a question about objective c. I bought a book about objective c. I am new in objective c and the book include many tutorials about memory management. I have the mac version 10.7.5. So in the tutorial about dealloc, xcode say me "ARC forbids explicit message send of 'dealloc'". So i search this error in many forums. In these forums many people say that [super dealloc] inherits from NSObject is old and the newer version of system make the memory management automatically. The book comes out 2011.
I hope everyone understand me.
Thank you in advance.
There is a new(ish) system for iOS called ARC which automatically sends release/retain/dealloc etc. messages to your objects. You may read more about it here.
The important thing to note when answering your question is that ARC is optional. You may use it, but you do not have to. (When creating a new XCode project, you either tick the "enable automatic reference counting" button, or you don't.)
So, to answer your question: if you are using ARC in your project, yes, dealloc
is no longer necessary. If you're not using ARC, you will still need to manage your own memory. It depends on how you're setting up your project.
这篇关于目标C-[super dealloc]旧吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!