添加SDWebImage框架时出现Xcode clang错误 [英] Xcode clang error when adding SDWebImage framework

查看:966
本文介绍了添加SDWebImage框架时出现Xcode clang错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译一个使用SDWebImage的应用程序,当我添加框架到xCode我不断得到以下错误。



我试图通过克隆git repo添加框架

  ld:framework not found SDWebImage 
clang:error:linker命令失败,退出代码1(使用-v查看调用)

解决方案

在Xcode中链接需要有点工作。我们可以告诉做什么或建议一个更好的方法。因为我认为删除框架解决方案是一个很糟糕的习惯,我强烈建议一个更好的方法:



使用依赖管理器 p>

这将帮助你看到每当你的依赖项得到新的更新。你还会知道你使用的是哪个版本。这是一个很好的做法。



您可以使用 Cocoapods 。转到您的终端,输入:

  $ sudo gem install cocoapods 

然后转到您的项目文件夹(放置 xcodeproj )并输入:

  $ pod init 

这将创建一个名为 Podfile 的文件。打开它并粘贴:

 平台:ios,'8.0'//或任何你需要的
use_frameworks!

pod'SDWebImage','〜> 3.7'

所以当你准备好了,打开终端并输入:

  $ pod install 

现在你应该在 xcworkspace 而不是od xcodeproj 上工作。您的依赖关系应该正常工作。



BTW:还有很多其他解决方案。您只需使用 git子模块即可。您也可以使用 Carthage 。但是最受欢迎的是,对于我atm最方便的方式是 Cocoapods ,所以我写这样的步骤。


I am trying to compile an app that use SDWebImage, when I add the framework to xCode I keep getting the following error.

I have attempted to add the framework by clone the git repo

ld: framework not found SDWebImage
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方案

Linking in Xcode requires a bit of work. We can tell what to do or suggest a better way. As I consider "dropping framework" solution a very bad habit, I'd strongly suggest a better way:

Use dependency manager!

This will help you to see whenever your dependencies get new updates. You'll also know which version are you using. This is a good practice.

You can eg use Cocoapods. Go to your Terminal, type:

$ sudo gem install cocoapods

Then go to your project folder (place, where you have xcodeproj) and type:

$ pod init

This creates a file named Podfile. Open it and paste:

platform :ios, '8.0' // or whatever you need
use_frameworks!

pod 'SDWebImage', '~> 3.7'

So when you have it ready, open Terminal and type:

$ pod install

From now you should work on xcworkspace instead od xcodeproj. Your dependency should work correctly.

BTW: There are many other solutions. You can simply use git submodules. You can also use Carthage. However most popular and as for me atm most convenient way is Cocoapods, so I wrote steps for this way.

这篇关于添加SDWebImage框架时出现Xcode clang错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆