在 Xcode 3.2 中使用第三方框架时遇到问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1670672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Trouble Using Third Party Framework In Xcode 3.2
提问by MarkPowell
I am attempting to set up my own project using a third party library (MPOAuthConnection) for connecting to an oauth REST API.
我正在尝试使用第三方库 (MPOAuthConnection) 来设置我自己的项目以连接到 oauth REST API。
Steps I've gone through thus far:
到目前为止我经历的步骤:
- Downloaded source for MPOAuthConnection.
- Built source and had a resulting MPOAuth.framework in the Product tab.
- Opened my existing project and dragged the MPOAuth.framework into the "Linked Frameworks" of my project.
- Build my project and it fails at Runtime with the following error
- 已下载 MPOAuthConnection 的源代码。
- 构建源代码并在“产品”选项卡中生成 MPOAuth.framework。
- 打开我现有的项目并将 MPOAuth.framework 拖到我的项目的“链接框架”中。
- 构建我的项目,它在运行时失败并出现以下错误
[Session started at 2009-11-03 16:41:37 -0600.]
Warning - No location found for "OAuthClientController.m:68"
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys002
Loading program into debugger…
sharedlibrary apply-load-rules all
warning: Unable to read symbols for
"@executable_path/../Frameworks/MPOAuth.framework/Versions/A/MPOAuth" (file not found).
warning: Unable to read symbols from "MPOAuth" (not yet mapped into memory).
Program loaded.
run
[Switching to process 32686]
Running…
dyld: Library not loaded:
@executable_path/../Frameworks/MPOAuth.framework/Versions/A/MPOAuth
Referenced from:
/Users/markpowell/Documents/Programming/Cocoa/Celery/build/Debug/Celery.app/Contents/MacOS/Celery
Reason: image not found
No memory available to program now: unsafe to call malloc
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)
[会话开始于 2009-11-03 16:41:37 -0600。]
警告 - 找不到“OAuthClientController.m:68”的位置
GNU gdb 6.3.50-20050815(Apple 版本 gdb-1344)(2001 年 7 月 3 日星期五) :19:56 UTC 2009)
版权所有 2004 Free Software Foundation, Inc.
GDB 是自由软件,受 GNU 通用公共许可证保护,
欢迎您在特定条件下更改它和/或分发它的副本。
输入“show copying”以查看条件。
GDB 绝对没有保修。输入“显示保修”了解详情。
此 GDB 配置为“x86_64-apple-darwin”.tty /dev/ttys002
正在将程序加载到调试器中……
sharedlibrary apply-load-rules all
警告:无法读取
“@executable_path/../Frameworks/MPOAuth.framework/Versions/A/MPOAuth”的符号(未找到文件)。
警告:无法从“MPOAuth”中读取符号(尚未映射到内存中)。
程序加载。
运行
[切换到进程 32686] 正在
运行...
dyld:库未加载:
@executable_path/../Frameworks/MPOAuth.framework/Versions/A/MPOAuth
引用自:
/Users/markpowell/Documents/Programming/Cocoa/Celery/build/ Debug/Celery.app/Contents/MacOS/Celery
原因:找不到图像
现在没有可用于编程的内存:调用 malloc 不安全
数据格式化程序暂时不可用,将在“继续”后重试。(此时调用 dlopen 不安全。)
So apparently, it can't find any of the framework information at runtime, but can at compile time? I'm a bit new to the OS X platform, so still struggling a bit with the tools. Any help would be greatly appreciated.
很明显,它在运行时找不到任何框架信息,但在编译时可以吗?我对 OS X 平台有点陌生,所以仍然在使用工具方面有些挣扎。任何帮助将不胜感激。
EDIT:I did add a new Build Phase -> New Copy Files Build phase, dragged the Framework (MPOAuth.framework) to the dialog and set it to go to Frameworks. But still got the same error.
编辑:我确实添加了一个新的构建阶段 - > 新复制文件构建阶段,将框架(MPOAuth.framework)拖到对话框中并将其设置为转到框架。但仍然得到同样的错误。
回答by Lyndsey Ferguson
It looks like you haven't copied the MPOAuth framework into your application bundle:
看起来您还没有将 MPOAuth 框架复制到您的应用程序包中:
"@executable_path/../Frameworks/MPOAuth.framework/Versions/A/MPOAuth" (file not found).
“@executable_path/../Frameworks/MPOAuth.framework/Versions/A/MPOAuth”(未找到文件)。
The @exectuable_path is the path to your application binary inside of ".../MyApp.app/Contents/MacOS"
@exectuable_path 是“.../MyApp.app/Contents/MacOS”中应用程序二进制文件的路径
You should create a new build phase for your target, "Copy Files Phase" that specifies the destination as "Frameworks". Drag the MPOAuth framework in your Xcode project into that path and it will be copied into the correct location.
您应该为目标创建一个新的构建阶段,即“复制文件阶段”,将目标指定为“框架”。将 Xcode 项目中的 MPOAuth 框架拖到该路径中,它将被复制到正确的位置。
EDIT Nov 3rd, 2009: 17:59 EST: I would highly suggest reading the Xcode documentation as it saved me a ton of time when I learned how to use this tool effectively. Select "Xcode Help" from the "Help" menu while Xcode is active.
编辑 2009 年 11 月 3 日:美国东部标准时间 17:59:我强烈建议阅读 Xcode 文档,因为当我学习如何有效地使用此工具时,它为我节省了大量时间。当 Xcode 处于活动状态时,从“帮助”菜单中选择“Xcode 帮助”。