如何在 Xcode 5 中为单个文件禁用 ARC?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18883726/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:48:58  来源:igfitidea点击:

How to disable ARC for a single file in Xcode 5?

iosobjective-cxcodeautomatic-ref-counting

提问by Undo

I recently downloaded Xcode 5, and it's now my primary IDE. However, I now need to disable Automatic Reference Counting for a single file in my project.

我最近下载了 Xcode 5,它现在是我的主要 IDE。但是,我现在需要为我的项目中的单个文件禁用自动引用计数。

In Xcode 4, I went to the Build Phases tab under my target, and I could double click the on the right side of a row in the Compile Sources section, add -fno-objc-arcto the list of compiler flags, and be off.

在 Xcode 4 中,我转到目标下的 Build Phases 选项卡,我可以双击 Compile Sources 部分中一行右侧的 ,添加-fno-objc-arc到编译器标志列表中,然后关闭。

In 5, however, the column seems to be unclickable:

然而,在 5 中,该列似乎无法点击:

enter image description here

在此处输入图片说明

So, how do I do this?

那么,我该怎么做呢?

回答by Kjuly

Well, I just tried and found that you must had dragged the window to a smaller width. You need to drag it back to show the Compiler Flagcolumn:

好吧,我刚刚尝试过,发现您一定是将窗口拖到了更小的宽度。您需要将其拖回以显示该Compiler Flag列:

回答by Henry F

To fix the real issue rather than a GUI issue, select the file and press ENTER, then you can add the -fno-objc-arccompiler flag.

要解决真正的问题而不是 GUI 问题,请选择文件并按 ENTER,然后您可以添加-fno-objc-arc编译器标志。

回答by Tommy

You appear to be missing the right-hand column. On my install it looks like this:

您似乎缺少右侧的列。在我的安装中它看起来像这样:

enter image description here

在此处输入图片说明

Notice the 'Compiler Flags' column to the right of the 'Name' column.

请注意“名称”列右侧的“编译器标志”列。

Double-clicking anywhere on the row allows me to type into the flags as long as that column is on screen. Making my window sufficiently thin causes it to be invisible so the first thing I'd try is making your window super-wide, to see whether you can get a flags column.

只要该列在屏幕上,双击行上的任何地方都可以让我输入标志。使我的窗口足够薄会使其不可见,因此我首先要尝试使您的窗口超宽,以查看是否可以获得标志列。