问题描述
此崩溃一直是一个阻塞问题,我使用以下步骤重现该问题:
This crash has been a blocking issue I used the following steps to reproduce the issue:
- 创建 Cocoa Touch 框架项目
- 添加一个 swift 文件和一个类 Dog
- 构建设备框架
- 在 Swift 中创建一个单一视图应用程序
- 将框架导入应用项目
- 从 ViewController 中的框架实例化 swift 类
- 在设备上构建并运行应用
应用程序启动后立即崩溃,这是控制台日志:
The app immediate crashed upon launching, here is console log:
dyld: Library not loaded: @rpath/FrameworkTest03.framework/FrameworkTest03
Referenced from: /var/mobile/Applications/FA6BAAC8-1AAD-49B4-8326-F30F66458CB6/FrameworkTest03App.app/FrameworkTest03App
Reason: image not found
我尝试在 iOS 7.1 和 8.0 设备上进行构建,它们都遇到了相同的崩溃.但是,我可以构建一个应用程序并在模拟器上正常运行.另外,我知道我可以在 Link Binary With Libraries 中将框架更改为 Required 到 Optional,但它并没有完全解决问题,当我创建一个 Dog 实例时,应用程序崩溃了.设备和模拟器上的行为不同,我怀疑我们无法使用 Xcode 的 beta 版本为设备分发框架.任何人都可以阐明这一点吗?
I have tried to build on iOS 7.1 and 8.0 devices, they both have the same crash. However, I can build an app and run on the simulator fine. Also, I am aware that I can change the framework to form Required to Optional in Link Binary With Libraries, but it did not completely resolve the problem, the app crashed when I create an instance of Dog. The behavior is different on the device and simulator, I suspect that we can't distribute a framework for the device using a beta version of Xcode. Can anyone shed light on this?
推荐答案
在目标的 General 选项卡中,有一个 Embedded Binaries 字段.当你在那里添加框架时,崩溃就解决了.
In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved.
参考此处在 Apple 开发者论坛上.
Reference is here on Apple Developer Forums.
这篇关于带有框架的 iOS 应用程序在设备上崩溃,dyld:库未加载,Xcode 6 Beta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!