Xcode ARC(自动引用计数),“释放不可用” [英] Xcode ARC (automatic reference counting), "release is unavailable"
问题描述
我第一次使用Xcode时,我遵循教程。
我所做的一切都是教程告诉我,但我恐怕太过时了。
For my first time using Xcode I was following a tutorial online. I did everything as the tutorial showed me, but I am afraid that it's too outdated.
encounter是:
The error I encounter is:
[font_attributes release];
'release'不可用:在自动引用计数模式下不可用
'release' is unavailable: not available in automatic reference counting mode
ARC禁止发布'release'的显示邮件
ARC forbids explicit message send of 'release'
我如何修复 ARC
问题?
推荐答案
您有两个选项:
1)关闭ARC为这个项目。
这是通过在目标的构建设置标签中将Objective-C自动引用计数设置为否
1) Turn off ARC for this project. This is done by setting 'Objective-C Automatic Reference Counting' to NO in the 'Build Settings' tab of your target in the project page.
2)删除所有 retain
发布
autorelease
NSAutoReleasePools
和 retainCount
他们为你。除了 NSAutoReleasePool
s它们已被 @autorelease {}
替换。
2) Remove all retain
release
autorelease
NSAutoReleasePools
and retainCount
calls, since ARC makes them for you. With the exception of NSAutoReleasePool
s They have been replaced by @autorelease{}
.
第二个选项已由苹果自动查看此问题以使用重构工具。
这篇关于Xcode ARC(自动引用计数),“释放不可用”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!