Xcode 7 中 CocoaPods 编译报错 dyld: Library not loaded: @rpath/Pods.framework/Pods

问题症状与解决

在 Xcode 7 beta 3 (7A152u) 中创建 Swift 项目,并使用 CocoaPods 做依赖管理,编译时会遇到如下的报错:

dyld: Library not loaded: @rpath/Pods.framework/Pods
  Referenced from: /private/var/mobile/Containers/Bundle/Application/26B91138-7483-40B0-9BE6-D27072472895/AppName.app/AppName
  Reason: image not found
(lldb) 

这个错误只在真机测试上遇到,模拟器没有问题。

解决方案是点击 target 的 Build Settings,切换到 All,搜索 bitcode,将其设置为 No,即可编译通过。

Bitcode 介绍

当项目进行编译时,Xcode 使用 clang 或者 swiftc 对项目进行编译,然后交给 LLVM 来创建二进制的包,以适配虚拟机(x86/64)和真机(arm6/arm7/arm7s/arm64)环境。这样得来的二进制包,被称为“胖二进制包”(Fat Binary)。

如果启用 Bitcode 的话,那么生成“胖二进制包”的过程会被去掉,LLVM 只会生成一个中间语言 bitcode 包。这么干是有不少好处的,但是就不能在所有环境运行了,所以后面一步打包工作总是需要有人来做的——App Store来干这个事儿。这样一来,包体积更小,运行也更快了,也是 iOS9 “瘦身功能”的一部分。未来,所有的 WatchOS 应用会强制 bitcode 提交,但 iOS 应用还没有这个要求。

参考

App Thinning (iOS, watchOS):
https://developer.apple.com/library/prerelease/watchos/documentation/IDEs/Conceptual/AppDistributionGuide/AppThinning/AppThinning.html

Fat Binary:
https://en.wikipedia.org/wiki/Fat_binary#Apple.27s_Universal_binary

LLVM:
https://zh.wikipedia.org/wiki/LLVM

Impact of Xcode build options “Enable bitcode” Yes/No:
http://stackoverflow.com/questions/31088618/impact-of-xcode-build-options-enable-bitcode-yes-no

Xcode 7 dyld:Library not loaded image not found:
https://github.com/CocoaPods/CocoaPods/issues/3661

dyld: Library not loaded: @rpath/Pods.framework/Pods
https://github.com/CocoaPods/CocoaPods/issues/3586

时间: 2024-10-18 08:31:56

Xcode 7 中 CocoaPods 编译报错 dyld: Library not loaded: @rpath/Pods.framework/Pods的相关文章

[iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN

[iOS Xcode8报错]dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserN 升级了Xcode8,但是我的真机是iOS7系统,在我解决了Xcode8不支持iOS7系统以后(http://blog.csdn.net/iOSTianNan/article/details/52619319),真机调试出现如下报错 dyld: Library not loaded: /System

iOS 报错信息: dyld: Library not loaded: @rpath/XCTest.framework/XCTest Referenced from

新建项目,引入framework,运行时出现警告:dyld: Library not loaded: @rpath/RLLibrary.framework/RLLibrary Referenced from: /var/mobile/Applications/AE92B234-A818-445E-9D69-96E232BD50EB/RLProjectDemo.app/RLProjectDemo Reason: image not found 看网上不少人说是将 上图Link Binary Wit

IOS运行报错 "dyld: Library not loaded" 原因分析

我们的游戏IOS版在接入易接SDK后,启动出现如下错误 dyld: Library not loaded: @rpath/OnlineAHelper.framework/OnlineAHelper Referenced from: /var/mobile/Containers/Bundle/Application/35ED2A71-7F60-4A16-BA4C-ECD6493A1EE1/yzg.app/yzg Reason: no suitable image found. Did find:

ios dyld: Library not loaded: @rpath/xxx.framework/xxx 之根本原因

碰到问题 dyld: Library not loaded: @rpath/xxx.framework/xxx Referenced from: /var/containers/Bundle/Application/0F41980D-5091-449D-AE29-5D018E3EB554/DemoOC.app/DemoOC Reason: image not found enable Always Embed Swift Standard Libraries option under Build

dyld: Library not loaded: @rpath/MySDK.framework/MySDK 错误解决

dyld: Library not loaded: @rpath/MySDK.framework/MySDK   Referenced from: /var/mobile/Applications/08B6D2C2-5028-4A64-93F5-1252B0B0BCAB/MyApp.app/MyApp   Reason: no suitable image found.  Did find: /private/var/mobile/Applications/08B6D2C2-5028-4A64-

dyld: Library not loaded: @rpath/XCTest.framework/XCTest

最近用别人的传给的源代码,发现出现dyld: Library not loaded:问题. 控制台出现如此的输出:dyld: Library not loaded: @rpath/XCTest.framework/XCTest......   经过大量的资料查询,发现是Build Phases 里的Compile Sources 里包含有__Tests.m或者__UITests.m文件,   如需解决,只需将包含__Tests.m或者__UITests.m的编译文件删除就OK了.

dyld: Library not loaded: @rpath/XCTest.framework/XCTest Referenced from: /private/var/mobile/Conta

dyld: Library not loaded: @rpath/XCTest.framework/XCTest Referenced from: /private/var/mobile/Containers/Bundle/Application/3A8F980D-F647-4D6D-B95A-88EC600BCA6B/RR.app/RR Reason: image not found 解决办法:工程->targets->Bulid Phases->complie Sources->

iOS 报错 : dyld: Library not loaded: @rpath/

今天用阿里短视频点播短视频服务按照上边引导导入sdk后编译报错: dyld: Library not loaded: @rpath/ 整了半天 结果是目前iOS的短视频SDK输出的都是动态库,需要以动态库的方式添加. 需要在MyApp的工程中做如下配置

dyld: Library not loaded: @rpath/libswiftCore.dyli

今天代码写的很烦躁,写完了,编译成功后,居然,尼玛,直接崩了.控制台输出如下错误: /****************************************************************/ tao  14:37:17dyld: Library not loaded: @rpath/libswiftCore.dylib  Referenced from: /Users/codinghacker/Library/Developer/CoreSimulator/Device