当然,我在发布我的问题之前进行了研究.
of course i did research before posting my question.
我看过
如何添加现有框架"在 Xcode 4 中?
在 Xcode 4 中添加框架
在 Xcode 4 中添加 OpenGL 框架
XCode 4 添加 dylib
但整个事情都变得错误了.
but whole thing is becoming wrong.
我的目标:将(CorePlot)框架添加到 XCode Mac 项目(不是 iPhone)
My goal: Add (CorePlot) framework to XCode Mac project (not an iPhone one)
我的环境:OSX Lion 10.7、SDK Lion、XCode 4.1 (4B110)
My environment: OSX Lion 10.7, SDK Lion, XCode 4.1 (4B110)
我的步骤:
Build Phases >将二进制文件与库链接
然后运行我的项目
我得到的是这个错误信息:
what I got is this error message:
dyld: Library not loaded: @loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/metralight-hjuvuwlhgohrtdeepvcymnsaxomc/Build/Products/Debug/metralight.app/Contents/MacOS/metralight
Reason: image not found
事实上,当我查看给定目录(应用程序包)时,没有目录Frameworks
,因此链接无法成功
And in fact, when I looked into given directory (app bundle) there was no directory Frameworks
and so the linking cannot be successful
我又搜索了一个,发现我可以创建 Build Rule
并通过一些脚本将文件复制到最终的二进制包中,但这是唯一的方法吗?
I have searched one more, and found, that I can create Build Rule
and copy files into final binary bundle via some script, but is this only way how to do this?
是否有一些选项可以打开/关闭将链接的框架复制到最终包?
Isn't there some option to just turn on/off copying linked frameworks to final bundle?
请注意,CorePlot 目标.framework"的 Dynamic Library Install Name
设置为 @loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot
,所以它在最终的二进制包中寻找正确的位置
Note that CorePlot target '.framework' has Dynamic Library Install Name
set to @loader_path/../Frameworks/CorePlot.framework/Versions/A/CorePlot
, so it is looking in right place in final binary bundle
通过添加现有框架"添加框架后
After adding framework via "Add existing framework"
项目设置
> 构建阶段
Add buid phase
> Copy Files
框架
就是这样.
这篇关于向 XCode 4 添加框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!