xcode 如何为整个文件组/文件夹禁用 ARC?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8926969/
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
How can I disable ARC for an entire group/folder of files?
提问by Camsoft
I'm aware that you can set the compiler flag -fno-objc-arc
to disable Automatic Reference Counting (ARC) for each file in Compile Sources in XCODE but how can I do this for an entire group of files without having to do each file at a time?
我知道您可以设置编译器标志-fno-objc-arc
以禁用 XCODE 编译源中每个文件的自动引用计数(ARC),但是如何在不必一次执行每个文件的情况下对整个文件组执行此操作?
The reason I ask is that I've added a large library to my application and I need to set the -fno-objc-arc
compiler flag for over 100 files.
我问的原因是我在我的应用程序中添加了一个大型库,我需要-fno-objc-arc
为 100 多个文件设置编译器标志。
回答by Krrish
Goto Build Phases -> Compile sources
select multiple files holding command ?and press enter then add the value -fno-objc-arc
It will reflect for all the selected files.
转到Build Phases -> Compile sources
选择多个文件command ?,然后按 Enter 然后添加值-fno-objc-arc
它将反映所有选定的文件。
回答by dasblinkenlight
I do not think that XCode lets you set this flag for a folder or a group, but you have two reasonable alternatives to setting the flag on individual files:
我不认为 XCode 允许您为文件夹或组设置此标志,但是您有两种合理的替代方法可以在单个文件上设置标志:
- If your library is self-contained, you can create a separate project for it in the same workspace as your application, and disable ARC for that project.
- If you are OK modifying the source of that library, you can attempt an automated ARC conversion.
- 如果您的库是自包含的,您可以在与您的应用程序相同的工作区中为其创建一个单独的项目,并为该项目禁用 ARC。
- 如果您可以修改该库的源代码,则可以尝试自动 ARC 转换。