0

我正在尝试将来自https://github.com/nicklockwood/iRate的 iRate 添加到我的应用程序中。

添加文件后,我什至在运行项目之前就收到了这个错误。

#import "iRate.h"
#import <Availability.h>
#if !__has_feature(objc_arc)
#error This class requires automatic reference counting
#endif

http://i.stack.imgur.com/amxPM.png

4

1 回答 1

2

此链接中此问题的解决方案https://github.com/nicklockwood/iRate。这是为了 ARC 兼容性。

从 1.7 版开始,iRate 需要 ARC。如果您希望在非 ARC 项目中使用 iRate,只需将 -fobjc-arc 编译器标志添加到 iRate.m 类。为此,请转到目标设置中的 Build Phases 选项卡,打开 Compile Sources 组,双击列表中的 iRate.m 并在弹出窗口中键入 -fobjc-arc。

如果您希望将整个项目转换为 ARC,请注释掉 iRate.m 中的 #error 行,然后在 Xcode 中运行 Edit > Refactor > Convert to Objective-C ARC... 工具并确保所有文件都符合您的要求使用 ARC(包括 iRate.m)被选中。

于 2015-05-22T12:17:22.497 回答