升级到ARC后,我是否必须摆脱发布声明? [英] Do I have to get rid of my release statements upon upgrading to ARC?

查看:58
本文介绍了升级到ARC后,我是否必须摆脱发布声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有这些ARC内容都是新手.

New to all this ARC stuff.

我一直在使用cocos2d-iphone 1.0.1的手动引用计数"来开发iOS游戏.

I've been developing an iOS game using Manual Reference Counting with cocos2d-iphone 1.0.1 this whole time.

最近,在阅读了一些说明后( http://www.tinytimgames.com/2011/07/22/cocos2d-and-arc/#comment-563567859 ),我升级了项目以支持自动引用计数.

Recently, upon reading some instructions (http://www.tinytimgames.com/2011/07/22/cocos2d-and-arc/#comment-563567859), I upgraded my project to support Automatic Reference Counting.

当我使用手动方法进行开发时,我当然在很多地方都使用了release.但是,我注意到我有很多内存泄漏,而且很难找到所有这些泄漏-因此我改用了ARC.

When I developed using the manual method, I, of course, used release in many places. However, I noticed that I had many memory leaks and I was having a hard time finding all of them - thus I changed to ARC.

但是,我想知道,是否必须删除[object release];语句才能使ARC正常工作?还是没关系,我真的根本不需要做任何改变?

However, I wonder, do I have to erase my [object release]; statements for ARC to work properly? Or it doesn't matter and I really don't have to do any kind of change at all?

如果我使用了[object retain];[object release];,是否可以摆脱前者并假定ARC将负责释放它?还是自从我明确拥有该对象的所有权以来,我还是有责任手动释放它吗?

If I used [object retain]; and [object release];, do I get rid of the former and assume that ARC will take care of releasing it? Or do I still have the responsibility of releasing manually it since I explicitly took ownership of the object?

推荐答案

无需手动执行所有这些操作.

NO need to manually do all these stuffs.

您应该重构您的代码. 在此处检查如何重构到ARC.

如何做我可以将Xcode项目转换为使用ARC(自动引用计数)吗?

这篇关于升级到ARC后,我是否必须摆脱发布声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆