【发布时间】:2015-04-17 08:40:17
【问题描述】:
我正在使用 cocoapods 开发一个 Swift 项目。这是 Podfile:
pod 'GPUImage', '~> 0.1.4'
-
在我运行
pod install后,我尝试得到关于导入文件的错误:导入 GPUImage
我从 podfile 中卸载了 GPUImage,然后尝试第二个解决方案,我得到了不同的错误。
-
这个link是github上的项目说明。我的步骤是:
将 GPUImage.xcodeproj 复制并粘贴到项目根目录中,并将其添加到我的项目中。
转到“Build settings”->“Build Phases”->“Target Dependencies”,添加了 PUImageFramework,在 Link Binary With Libraries 部分,添加了 GPUImage.framework。
但我得到了一个错误:
error: unable to read module map contents from 'Source/iOS/Framework/module.modulemap': Error Domain=NSCocoaErrorDomain Code=260 "The file “module.modulemap” couldn’t be opened because there is no such file." UserInfo=0x7f872cfb0b80 {NSFilePath=/Users/william/A/muguang-ios/Source/iOS/Framework/module.modulemap, NSUnderlyingError=0x7f87413f4dd0 "The operation couldn’t be completed. No such file or directory"}
任何帮助,谢谢!
编辑:
现在的错误是:
dyld: Library not loaded: @rpath/GPUImage.framework/GPUImage
Referenced from: /private/var/mobile/Containers/Bundle/Application/9CF1D10C-1D78-40CB-955F-19110B3C3EA8/testGDU.app/testGDU
Reason: image not found
编辑: 对于不使用 pod 的解决方案,这里是解决方案:
然后您需要添加一个新的 Copy Files 构建阶段,设置 Destination 到框架,并将 GPUImage.framework 构建产品添加到其中。 这将允许框架与您的应用程序捆绑在一起 (否则,您会看到神秘的“dyld:未加载库: @rpath/GPUImage.framework/GPUImage" 执行错误)。
但是关于 cocoapods 的问题 1 仍然无效。
【问题讨论】:
-
在带有 cocoapods 的 SnapKit 中遇到同样的错误。您找到 pod 的解决方案了吗?
-
我放弃了 pods 安装,手动添加。
-
我用 cocoapods
0.36.4对我的进行排序,而且我的一个文件没有类定义,这是导致错误的实际原因,甚至不是 pods。