在 Xcode 中导入私有框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4206133/
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
importing private frameworks in Xcode
提问by manatails008
I am a novice iPhone programmer I want to use some of the functions in the private framework
我是一个新手iPhone程序员我想使用私有框架中的一些功能
https://github.com/kennytm/iphone-private-frameworks
https://github.com/kennytm/iphone-private-frameworks
The function that I want to use is in 'SpringBoard'
我要使用的功能在“SpringBoard”中
So I downloaded 'SpringBoard' folder in that github repo. And created a subdirectory called "Headers" in 'SpringBoard' and put all the header files in that folder.
所以我在那个 github 存储库中下载了“SpringBoard”文件夹。并在“SpringBoard”中创建了一个名为“Headers”的子目录,并将所有头文件放在该文件夹中。
And renamed 'SpringBoard' to 'SpringBoard.framework' and copied it to /Developer/Platforms/(iPhoneOS_and_iPhoneSimulator)/sdks/System/library/Frameworks folder (I can't recall full path correctly sorry)
并将“SpringBoard”重命名为“SpringBoard.framework”并将其复制到 /Developer/Platforms/(iPhoneOS_and_iPhoneSimulator)/sdks/System/library/Frameworks 文件夹(抱歉,我记不清完整路径了)
And I got back to the xcode and right click on Frameworks -> Add existing framework -> other -> I selected 'SpringBoard.framework' folder and clicked Add.
我回到 xcode 并右键单击框架 -> 添加现有框架 -> 其他 -> 我选择了“SpringBoard.framework”文件夹并单击添加。
And I built the project and got an error
我构建了这个项目并得到了一个错误
'ld : framework SpringBoard not found'
'ld:未找到框架 SpringBoard'
My imported framework does appear on the Xcode and I can see header files in it. but when I built it I got that error.
我导入的框架确实出现在 Xcode 上,我可以在其中看到头文件。但是当我构建它时,我得到了那个错误。
What am I doing wrong?
我究竟做错了什么?
回答by WrightsCS
Place all of your private headers in a directory like: /User/Name/Headers/
then set USER_HEADER_SEARCH_PATHS = "/User/Name/Headers/"
and make sure that ALWAYS_SEARCH_USER_PATHS = YES
将您所有的私人标题放在一个目录中,例如:/User/Name/Headers/
然后设置USER_HEADER_SEARCH_PATHS = "/User/Name/Headers/"
并确保ALWAYS_SEARCH_USER_PATHS = YES
Also, SpringBoard.framework is not the way to do that.Simply place the folder namedSpringBoard
in the above Headers folder, making sure that the headers are directly inside them. For instance:SpringBoard/SBAlert.h
此外,SpringBoard.framework 不是这样做的方法。只需将命名的文件夹SpringBoard
放在上面的 Headers 文件夹中,确保标题直接在其中。例如:SpringBoard/SBAlert.h
/* SpringBoard is not a framework. */
Notice that you wont have to add the SpringBoard folder to your project, they should appear as you start typing, as long as you set the above headers correctly.
请注意,您不必将 SpringBoard 文件夹添加到您的项目中,只要您正确设置了上述标题,它们就会在您开始键入时出现。
回答by Enyra
I'm not sure if this works, but here a suggestion: I think the spring board framework should be in the UIKit framework you already linked anyway, so just add the header file to your project and it should work.
我不确定这是否有效,但这里有一个建议:我认为跳板框架应该在你已经链接的 UIKit 框架中,所以只需将头文件添加到你的项目中,它应该可以工作。
Otherwise this could help you: http://www.codethecode.com/projects/class-dump/