如何使用 log4cocoa 嵌入应用程序?

发布于 2024-09-12 17:21:35 字数 504 浏览 4 评论 0原文

我在将我的应用程序嵌入 log4cocoa 框架时遇到了一些麻烦。我之前已经在我的应用程序中嵌入了框架,没有遇到任何问题,但我无法修复这个问题。

首先,这是我的系统:

dyld: Library not loaded: @loader_path/Frameworks/Log4Cocoa.framework/Versions/A/Log4Cocoa
  Referenced from: /Users/leandro/Documents/Projects/MLoggerApplication/build/Debug/MLoggerApplication.app/Contents/MacOS/MLoggerApplication
  Reason: image not found

嗯,我认为已完成所有必要的步骤以使框架正常工作,包括复制文件阶段,并将构建选项上的安装目录更改为 @executable_path/../Frameworks 。

我希望问题足够清楚以得到您的帮助。 提前致谢。

I'm having some trouble to embed my application with the log4cocoa framework.I've embed frameworks in my application before with no trouble, but I cannot fix this one.

First of all, this is my system out:

dyld: Library not loaded: @loader_path/Frameworks/Log4Cocoa.framework/Versions/A/Log4Cocoa
  Referenced from: /Users/leandro/Documents/Projects/MLoggerApplication/build/Debug/MLoggerApplication.app/Contents/MacOS/MLoggerApplication
  Reason: image not found

Well, I think done all necessary steps to get a framework working fine including the copy files phase and changed the installation directory over the build options to @executable_path/../Frameworks .

I hope problem clear enough to receive your help.
Thanks in advance.

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

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

发布评论

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

评论(2

素年丶 2024-09-19 17:21:35

看起来您的框架没有被复制到您的目标中。如果框架不是系统的一部分(即,您必须将其与应用程序一起分发),则您不仅需要将可执行文件链接到框架,还需要将其复制到应用程序的 ./Frameworks 文件夹中。

为此,请添加复制文件构建阶段,选择“框架”作为构建阶段的目标,然后将框架(从 Xcode 项目中的 Frameworks 文件夹中)拖到刚刚创建的复制文件构建阶段下。如果您已经有框架的复制文件构建阶段,那么只需使用它而不是创建新的。

Looks like your framework isn't being copied into your target. If a framework isn't part of the system (ie, you have to distribute it with your app), you need to not only link your executable against the framework but to copy it into your app's ./Frameworks folder.

To do this, add a Copy Files build phase, select "Frameworks" as the build phase's destination, then drag the framework (from your Frameworks folder in your Xcode project) under that Copy Files build phase you just created. If you already have a Copy Files build phase for Frameworks, then just use it instead of creating a new one.

悟红尘 2024-09-19 17:21:35

首先,我的意思是,Joshua Nozzi 关于如何将应用程序嵌入框架的观点是完全正确的!

但 log4cocoa 有点不同,只能意识到这一点,因为它是一个开源代码,可以在 http:// 下载sourceforge.net/projects/log4cocoa/

该框架可以通过添加“复制文件构建阶段”而不是“框架”来与此配置一起使用,选择“产品目录”作为构建阶段的目标,然后将框架拖到“复制文件构建阶段”。

它与其他框架的区别在于这个构建变量:安装目录。它的默认值是:“/Frameworks”。
可以通过右键单击 log4cocoa(目标列表中的第一项)来访问此变量,然后选择“获取信息”,最后选择“构建”。

要将其用作“普通”框架,请在将“安装目录”值编辑为“@executable_path/../Frameworks”后重建它,或者如果您要使用它嵌入框架,则更喜欢“@loader_path/../Frameworks”。 ./框架”

Firstly, i mean, Joshua Nozzi is completely right about how is to embed an app with a framework!

But log4cocoa as a little different and could only realize that because it is an opensource code able for download at http://sourceforge.net/projects/log4cocoa/.

The framework could be used with this configuration by adding a "Copy Files build phase, but instead "Frameworks", select "Products Directory" as the build phase's destination, then drag the framework to that "Copy Files build phase.

The difference among this, and the other frameworks relies in this build variable: installation directory.It has as default value: "/Frameworks .
This variable can be accessed by right clicking on the log4cocoa(first item in the targets list), then select "Get Info" and finally "build".

To use it as "normal" framework rebuild it after you have edited the "installation directory" value to "@executable_path/../Frameworks" or if you are going to embed a framework with it, you would prefer "@loader_path/../Frameworks"

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