编译器标志 -fno-objc-arc 在 Swift 中不工作

Compiler Flag -fno-objc-arc not working in Swift

我的程序是用 Swift 编写的,class 依赖于 "no leak SKShapeNode." 这个 class 是用 Obj-C 编写的,因此需要编译器标志使用。我在 SKShapeNodeLeakFree.m 文件上实现了 -fno-objc-arc,但编译器仍然没有检测到 ARC 被禁用。

目标 "Build Phases" 的 "Compile Sources" 中的 -fno-objc-arc 设置看起来不错。

看来您一定是错误地在桥接 header 中导入了 .m 文件。您应该 #import 桥接 header 中的 .h 文件。这可以解释为什么您在 "Swift Compiler Error" 部分下看到 Objective-C ARC 消息。