我想将iOS-WebP作为pod添加到我的Swift项目中。
pod规范读取
来源'https://github.com/CocoaPods/Specs.git'
平台:ios,'8.0'
use_frameworks!
pod'iOS-WebP','0.4'
在Swift中,我使用import iOS_WebP
来使用该库。
但是,编译失败,库内的相对标头路径无法正确解析:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/.../Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/Pods-iOS-WebP-umbrella.h"
^
/Users/.../Build/Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/Pods-iOS-WebP-umbrella.h:3:9: note: in file included from /Users/.../Build/Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/Pods-iOS-WebP-umbrella.h:3:
#import "UIImage+WebP.h"
^
/Users/.../Build/Products/Debug-iphoneos/Pods/iOS_WebP.framework/Headers/UIImage+WebP.h:10:9: error: 'WebP/decode.h' file not found
#import <WebP/decode.h>
^
/Users/...ViewController.swift:3:8: error: could not build Objective-C module 'iOS_WebP'
import iOS_WebP
^
通过方案切换器独立构建库工作正常,它只是与Swift项目的集成失败。
清理DerivedData没有帮助,.xcconfig在OTHER_CFLAGS
和OTHER_LDFLAGS
中正确引用了库。
更新
如果我删除use_frameworks!
并通过ObjC Bridging标头包含库,它会起作用。有没有办法为单个广告连播禁用use_frameworks!
?
更新2
使用此pod文件,它会编译。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
xcodeproj 'xxx'
target "Frameworks", :exclusive => true do
link_with "xxx"
use_frameworks!
pod ....
end
target "StaticLibraries", :exclusive => true do
link_with "xxx"
pod 'iOS-WebP', '0.4'
end
问题是,现在当我启动应用程序时,它似乎找不到框架:
dyld:未加载库:@ rpath / XXX.framework / XXX 参考自:/ private / var / mobile / Containers / Bundle / Application / ... 原因:找不到图像 (lldb)