Ios SDWebImage仅适用于ARC。为项目启用ARC或使用-fobjc ARC标志

Ios SDWebImage仅适用于ARC。为项目启用ARC或使用-fobjc ARC标志,ios,xcode,sdwebimage,Ios,Xcode,Sdwebimage,我正在尝试在IOS项目中使用SDWebImage 我遵循他们github的以下说明: import the project as a static library. Add the SDWebImage project to your project Download and unzip the last version of the framework from the download page Right-click on the project navigator and selec

我正在尝试在IOS项目中使用SDWebImage

我遵循他们github的以下说明:

import the project as a static library.

Add the SDWebImage project to your project

Download and unzip the last version of the framework from the download page
Right-click on the project navigator and select "Add Files to "Your Project":
In the dialog, select SDWebImage.framework:
Check the "Copy items into destination group's folder (if needed)" checkbox
Add dependencies

In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block:
Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
Add Linker Flag

Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag:



Import headers in your source files

In the source files where you need to use the library, import the header file:

#import <SDWebImage/UIImageView+WebCache.h>
我尝试搜索一些其他答案所说的标题搜索路径,结果如下:

Always search user paths -No
Header search paths
User header search paths
我必须在那里设置一个值吗?或者我应该做些什么

我在他们的演示中注意到的另一件事是:在他们的演示中,在frameworks文件夹中,他们导入了sdwebimageview的.xcodeproject,我导入了sdwebimageview.framework,正如github中的说明所示

谢谢

编辑:我的项目是非圆弧的

我尝试将
其他链接器标志从-ObjC更改为fobjc arc
,但仍然得到相同的错误

1) 这是对的,还是我应该换些别的? 2) 如果我将项目从非圆弧更改为圆弧,我应该更改什么?我只想使用那个库,所以我不想改变它

在.h文件os SDWebImage中,它表示:

#if !__has_feature(objc_arc)
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif
演示如何在项目中为每个文件设置圆弧或非圆弧

除非您想切换到ARC,否则我建议您保持项目原样,只需为SDWebImage中的文件启用
-fobjc ARC
选项。请看上面的教程,中的图像显示了将标志放置在何处。(他们的示例使用了
-fno-objc-arc
,这与此相反,因此请确保使用
-fobjc-arc
。您可以在相同的位置键入它。)

演示如何在项目中为每个文件设置圆弧或非圆弧


除非您想切换到ARC,否则我建议您保持项目原样,只需为SDWebImage中的文件启用
-fobjc ARC
选项。请看上面的教程,中的图像显示了将标志放置在何处。(他们的示例使用了
-fno-objc-arc
,这与此相反,所以请确保使用
-fobjc-arc
。您在相同的位置键入它。)

您的项目是否为非圆弧?是的。我的意思是,当我创建它时,我记得没有检查它。但是因为时间太长了,我到哪里去查呢?请看最后一个答案。实际上,我可以建议您通过Cocoapods安装第三部分代码,这将为您节省大量时间@Flink是的,这是一个非ARC项目。那怎么办呢?启用它?然后我必须在代码中更改哪些内容。我认为我的一些结构应该改变,不是吗?你也可以看我的编辑。你的项目是非弧的吗?是的。我的意思是,当我创建它时,我记得没有检查它。但是因为时间太长了,我到哪里去查呢?请看最后一个答案。实际上,我可以建议您通过Cocoapods安装第三部分代码,这将为您节省大量时间@Flink是的,这是一个非ARC项目。那怎么办呢?启用它?然后我必须在代码中更改哪些内容。我认为我的一些结构应该改变,不是吗?你也可以看我的编辑。
#if !__has_feature(objc_arc)
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif