在 NSBundle 中使用 ConnectionKit 框架

发布于 2025-01-06 15:27:32 字数 1419 浏览 0 评论 0原文

更新

从那以后,我花时间学习如何使用 install_name_toolotool 正确执行此操作,并在此处记录了该过程:在 NSBundles 中使用框架


我想使用 Connection Kit 框架。

为了让我的包能够成功加载框架,我将动态库安装名称更改为使用@loader_path,而不是@executable_path

Connection Kit 动态库安装名称

在我的 NSBundle 中构建并包含框架后,然后构建该框架,运行加载我的程序的程序捆绑包,我的捆绑包无法加载并产生以下输出:

Error loading MyBundle.rwplugin/Contents/MacOS/MyBundle:  dlopen(/Users/facelap/Library/Developer/Xcode/DerivedData/MyBundle-hiyhdkndcnuhspfqwcuyneqobeou/Build/Products/Debug/MyBundle.rwplugin/Contents/MacOS/MyBundle, 265): Library not loaded: @executable_path/../Frameworks/DAVKit.framework/Versions/A/DAVKit
  Referenced from: /Users/facelap/Library/Developer/Xcode/DerivedData/MyBundle-hiyhdkndcnuhspfqwcuyneqobeou/Build/Products/Debug/MyBundle.rwplugin/Contents/MacOS/../Frameworks/Connection.framework/Versions/A/Connection
  Reason: image not found

看来 Connection Kit 本身使用了一个框架。

我也有这个框架的源码。我尝试将其动态库安装名称设置为@loader_path,但这导致了类似的输出(并且捆绑包未能加载)。

对于要在 NSBundle 中使用的框架内的框架,动态库安装名称的合理条目是什么?

Update

I've since spent time learning how to use install_name_tool & otool to do this properly, and documented the process here: Using Frameworks Within NSBundles


I would like to use the Connection Kit framework within an NSBundle I am making.

To allow my bundle to load the framework successfully, I've changed the dynamic library install name to use @loader_path as opposed to @executable_path.

Connection Kit dynamic library install name

After building and including the framework in my NSBundle, then building that, running the program that loads my bundle, my bundle fails to load and produces the following output:

Error loading MyBundle.rwplugin/Contents/MacOS/MyBundle:  dlopen(/Users/facelap/Library/Developer/Xcode/DerivedData/MyBundle-hiyhdkndcnuhspfqwcuyneqobeou/Build/Products/Debug/MyBundle.rwplugin/Contents/MacOS/MyBundle, 265): Library not loaded: @executable_path/../Frameworks/DAVKit.framework/Versions/A/DAVKit
  Referenced from: /Users/facelap/Library/Developer/Xcode/DerivedData/MyBundle-hiyhdkndcnuhspfqwcuyneqobeou/Build/Products/Debug/MyBundle.rwplugin/Contents/MacOS/../Frameworks/Connection.framework/Versions/A/Connection
  Reason: image not found

It seems that Connection Kit itself uses a framework.

I also have the source for this framework. I tried setting its dynamic library install name to @loader_path, but this resulted in similar output (and the bundle failed to loar).

What would a sane entry be for the dynamic library install name for a framework within a framework that is to be used within an NSBundle?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

客…行舟 2025-01-13 15:27:32

查看崩溃日志。它表示您的捆绑包无法加载 DAVKit.framework,因此最简单的方法是重建 ConnectionKit 框架,但不是嵌入 DAVKit.xcodeproj,而是插入 DAVKit 的所有源。最简单但更正确的方法是 ConnectionKit 和 DAVKit 框架的设置安装路径。
它的链接应该可以帮助您:
在可加载包中嵌入框架

Look at the crash log. It says that you bundle can't load DAVKit.framework so the easiest way - its rebuild ConnectionKit framework but instead of embedding DAVKit.xcodeproj insert all sources of DAVKit. Its easiest way but more correctly - its setup install path of ConnectionKit and DAVKit frameworks.
Its link should help you:
embedding frameworks in loadable bundles

海的爱人是光 2025-01-13 15:27:32

您应该将您的捆绑包与 DAVKit 链接起来,并以与包含 ConnectionKit 相同的方式将其包含在那里。这避免了交付多个深度的框架

You should link your bundle with DAVKit and include it there In the same way as you're including ConnectionKit. This avoids having multiple depths of frameworks being shipped

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文