在Mac App Bundle中嵌入框架 [英] Embedding frameworks in a Mac App Bundle

查看:157
本文介绍了在Mac App Bundle中嵌入框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将SDL和SDL_ttf框架添加到我的应用程序中,并且已经按照通常的方式进行了操作:在使用库链接二进制文件"部分中添加了它们,并添加了一个复制文件阶段,该阶段将它们复制到Frameworks目录中.这确实创建了具有嵌入式框架的应用程序捆绑包.但是,当我运行该应用程序时,出现此错误:

I'm trying to add SDL and SDL_ttf frameworks to my application and I've done it the usual way: added them in the "Link Binaries with Libraries" section and added a copy files phase that copies them to the Frameworks directory. This does create a app bundle with embedded frameworks. However, when I run the application, I get this error:

模型:库未加载:@ rpath/SDL_ttf.framework/Versions/A/SDL_ttf 引用自: /Users/matthew.davies/Library/Developer/Xcode/DerivedData/MacHub-ambfqujqxbxyiqapaoctvsucpdeu/Build/Products/Release/MacHub.app/Contents/MacOS/MacHub 原因:找不到图片

dyld: Library not loaded: @rpath/SDL_ttf.framework/Versions/A/SDL_ttf Referenced from: /Users/matthew.davies/Library/Developer/Xcode/DerivedData/MacHub-ambfqujqxbxyiqapaoctvsucpdeu/Build/Products/Release/MacHub.app/Contents/MacOS/MacHub Reason: image not found

我不确定该怎么做,以便使该应用程序即使嵌入在其捆绑包中也能找到框架.

I am not sure what else to do so that the app can find the frameworks despite being embedded in its bundle.

请问有什么想法吗?

推荐答案

我在网页评论中发现了原因.我需要将运行路径搜索路径"构建设置设置为"@loader_path/../Frameworks",然后找到框架.

I discovered the reason why in a comment on a webpage. I needed to set the "Runpath Search Paths" build setting to "@loader_path/../Frameworks" and the frameworks are found.

为什么在应用程序包的Frameworks目录中不自动搜索框架对我来说是一个完全的谜?你在听苹果吗? :)

Why frameworks are not automatically searched for in the Frameworks directory of an app bundle is a complete mystery to me? Are you listening Apple? :)

这篇关于在Mac App Bundle中嵌入框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆