未加载OS X框架库:'未找到图像' [英] OS X Framework Library not loaded: 'Image not found'

查看:126
本文介绍了未加载OS X框架库:'未找到图像'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个基本的OS X Framework,现在我只是创建了一个测试框架: TestMacFramework.framework ,我试图将它导入到全新的OS X应用程序项目。



我已经构建了.framework文件并将其导入到新项目中。该框架似乎可以链接,我可以引用public头文件我添加到框架构建阶段。



但是,当我尝试运行容器应用程序时,出现以下错误:

  dyld:库未加载:/Library/Frameworks/TestMacFramework.framework/Versions/A/TestMacFramework 
引用自:/ Users / samharman / Library / Developer / Xcode / DerivedData / TestMacContainer-dzabuelobzfknafuhmgooqhqrgzl / Build / Products / Debug / TestMacContainer.app / Contents / MacOS / TestMacContainer
原因:image not found

经过一些Google搜索后,我意识到我需要添加 Copy Files 部分以我的容器应用程序构建阶段,所以我已经完成了它,并设置它像这样...




然而,我仍然遇到运行时错误。我显然在这里做了一些错误的事情,但是这个引用Xcode 2的Apple开发者库资源并不是非常有用!



我错过了什么?



更新:

我可以在构建日志中看到我的 TestMacFramework.framework 正被复制到.app内容/框架目录中,但它并未安装到HD上的Library / Frameworks目录中。



如果手动复制 TestMacFramework.framework ,则构建链接正确无误。更新2

进入 Library / Frameworks 目录

解决方案

[from XCode 6 - > 7.3]



(是的,仍在使用XCode 9)

唯一要做的就是添加框架添加到常规选项卡中的嵌入式二进制文件部分您的应用目标



p>

I am trying to create a basic OS X Framework, right now I just have a test framework created: TestMacFramework.framework and I'm trying to import it into a brand new OS X Application project.

I have built the .framework file and imported it into the new project, The framework appears to link okay, and I can reference the public header file I added to the framework build phases section.

However, when I try to run the container Application I get the following Error:

dyld: Library not loaded: /Library/Frameworks/TestMacFramework.framework/Versions/A/TestMacFramework
  Referenced from: /Users/samharman/Library/Developer/Xcode/DerivedData/TestMacContainer-dzabuelobzfknafuhmgooqhqrgzl/Build/Products/Debug/TestMacContainer.app/Contents/MacOS/TestMacContainer
  Reason: image not found

After a bit of googling I realised I needed to add a Copy Files section to my container application build phases, so I have done this and set it up like so...

However, I am still getting the runtime error. I'm obviously doing something wrong here, but the Apple developer library resource for this references Xcode 2, so isn't very helpful!

What have I missed?

UPDATE:

I can see in the build log that my TestMacFramework.framework is being copied into the .app contents/frameworks directory, but it isn't being installed to the Library/Frameworks directory on the HD

UPDATE 2:

The build links correctly if I manually copy the TestMacFramework.framework into the Library/Frameworks directory

解决方案

[from XCode 6 -> 7.3]

(yes, still working on XCode 9)

The only thing to do is to add the framework to the "Embedded binaries" section in the "General" tab of your app target

这篇关于未加载OS X框架库:'未找到图像'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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