0

我创建了一个 Cocoa Touch 框架来集中我的通用 Swift 代码并将一些东西移到其中——现在我在我的另一个 Swift 项目中使用它,在一个工作区中。起初主项目已编译,但在启动时出现此错误:

dyld:库未加载:@rpath/libswiftCoreAudio.dylib 引用自:/Users/username/Library/Developer/Xcode/DerivedData/AppName-guvhnmqtcqhmmndemyhztmwxbkjq/Build/Products/Debug-iphonesimulator/JBS.framework/JBS 原因:找不到图像

我发现可以通过在框架中打开选项Embedded Content Contains Swift Code来修复它,但是我在日志中得到了一堆重复的符号,如下所示:

objc [19237]:类 GGLBundleUtil 在 /Users/username/Library/Developer/Xcode/DerivedData/AppName-guvhnmqtcqhmmndemyhztmwxbkjq/Build/Products/Debug-iphonesimulator/JBS.framework/JBS 和 /Users/username/Library/Developer 中实现/CoreSimulator/Devices/CCAD7FCA-BF5F-428A-8122-680B91300618/data/Containers/Bundle/Application/22DC1E4F-B631-450A-A157-A6ADA0126DE6/AppName.app/AppName。将使用两者之一。哪一个是未定义的。

我不认为我应该在框架中打开 Embedded Content Contains Swift Code 选项,但我不知道为什么框架找不到 Swift 库。任何人?

编辑:

当我尝试在设备上运行该应用程序时,我得到一个类似但不同的错误。似乎在抱怨看不到我的框架:

dyld:库未加载:@rpath/JBS.framework/JBS 引用自:/private/var/mobile/Containers/Bundle/Application/C7644037-E5A0-431E-A7DB-D3B124CDC677/AppName.app/AppName 原因:找不到图像

4

2 回答 2

0

The main problem was that when I tried to add the framework into the Embedded Binaries, I didn't pay good enough attention to the section names.

Instead I added it into the section which had the other Linked Frameworks and Libraries, because there were some other ones there already. Once I added it into the Embedded Binaries section (which also re-added it back to the Linked Frameworks and Libraries when I did) it no longer gave me the main error as seen in the title.

I still as of yet, however, haven't figured out how to solve the duplicate symbols error, which occurs all the time now even though Embedded Content Contains Swift Code is turned off everywhere. But that wasn't the main issue in my question.

于 2015-08-22T03:48:37.483 回答
0

你在设备上测试过吗?如果是这样,您的项目和框架之间的捆绑包 id 必须相同。

于 2015-08-22T02:14:23.937 回答