加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – 通过Cocoapods添加后Alamofire错误

发布时间:2020-12-14 19:05:01 所属栏目:百科 来源:网络整理
导读:我有一个用Objective-C编写的 Xcode项目.但是我想在 Swift中编写我的新屏幕并需要Alamofire框架.我的项目中已经有Swift文件,但尝试几次后出现以下错误: ld: warning: directory not found for option '-L/Users/USERNAME/Developer/APP NAME/build/Debug-ip
我有一个用Objective-C编写的 Xcode项目.但是我想在 Swift中编写我的新屏幕并需要Alamofire框架.我的项目中已经有Swift文件,但尝试几次后出现以下错误:

ld: warning: directory not found for option '-L/Users/USERNAME/Developer/APP NAME/build/Debug-iphoneos'
ld: warning: directory not found for option '-F/Users/USERNAME/Developer/APP NAME/build/Release-iphoneos'
ld: framework not found Alamofire
clang: error: linker command failed with exit code 1 (use -v to see invocation)

在终端我得到以下建议:

[!] The `APP NAME [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-APP-NAME/Pods-APP-NAME.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag,or
- Remove the build settings from the target.

[!] The `APP NAME [Release]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-APP-NAME/Pods-APP-NAME.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag,or
- Remove the build settings from the target.

我已经尝试将$(继承)添加到库搜索路径(Build Phases).

我的pod文件:

# Uncomment this line to define a global platform for your project
platform :ios,'8.0'
use_frameworks!

target 'APP-NAME' do
pod 'Alamofire','~> 2.0'
end

解决方法

你手动将Alamofire.framework文件拖到你的项目中,然后将二进制文件与框架链接(target-build phase-link binary with libraries-add Alamofire.framework)

我这样做是为了在swift 2.0,xcode 7.3中添加大部分第三方库

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读