It is possible to disable ARC for individual files by adding the -fno-objc-arc
compiler flag for those files.
(通过为这些文件添加-fno-objc-arc
编译器标志,可以禁用单个文件的ARC。)
You add compiler flags in Targets -> Build Phases -> Compile Sources.
(您可以在目标->构建阶段->编译源中添加编译器标志。)
You have to double click on the right column of the row under Compiler Flags . (您必须双击“ 编译器标志”下该行的右列。)
You can also add it to multiple files by holding the cmd button to select the files and then pressing enter to bring up the flag edit box. (您还可以通过以下方式将其添加到多个文件中:按住cmd按钮选择文件,然后按Enter弹出标记编辑框。)
(Note that editing multiple files will overwrite any flags that it may already have.) ((请注意,编辑多个文件将覆盖它可能已经拥有的所有标志。))
I created a sample project that has an example: https://github.com/jaminguy/NoArc
(我创建了一个带有示例的示例项目: https : //github.com/jaminguy/NoArc)
See this answer for more info: Disable Automatic Reference Counting for Some Files
(有关更多信息,请参见此答案: 禁用某些文件的自动引用计数)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…