xcode #import of iPhone Frameworks (ALAssetsLibrary.h) 的正确路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4571371/
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
Correct path for #import of iPhone Frameworks (ALAssetsLibrary.h)
提问by Steven Noyes
This may be the easiest points out there but it is stumping for some reason. I am trying to include the AssetsLibrary Framework and having issues with getting the compiler to see the actual include file for ALAssetsLibrary when using relative paths.
这可能是最简单的点,但出于某种原因,它很难受。我正在尝试包含 AssetsLibrary 框架,并且在使用相对路径时让编译器查看 ALAssetsLibrary 的实际包含文件时遇到问题。
I am currently using:
我目前正在使用:
#import </Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/AssetsLibrary.framework/Headers/ALAssetsLibrary.h>
And this works but is oh so bad in that it calls out the device and specific OS build. I have added the framework and everything links and runs. I just really do not like using the above absolute path and cannot get any relative paths to work. I have tried many combinations of using quotes ("") and braces (<>). Various relative paths to just System, Library, System/Library...
这有效,但太糟糕了,因为它会调用设备和特定的操作系统构建。我已经添加了框架,所有东西都链接并运行。我真的不喜欢使用上述绝对路径并且无法获得任何相对路径。我尝试了多种使用引号 ("") 和大括号 (<>) 的组合。系统、库、系统/库的各种相对路径...
XCode specifics: XCode 3.2.5
XCode 细节:XCode 3.2.5
Component versions Xcode IDE: 1760.0 Xcode Core: 1763.0 ToolSupport: 1758.0
组件版本 Xcode IDE:1760.0 Xcode Core:1763.0 ToolSupport:1758.0
回答by Steven Noyes
Found it. Don't know why I did not think of this earlier...
找到了。不知道为什么我没有早点想到这个......
#import <AssetsLibrary/AssetsLibrary.h>
Simple.
简单的。
回答by King-Wizard
In Swift:
在斯威夫特:
Please first of all add the AssetsLibrary framework to your Xcode project: click on the name of your project in the project navigator < Then click on the name of your project under TARGETS < Then click on Build Phases < Then click on Link Binary With Libraries < Then click on the "+ button" and add the AssetsLibrary.framework
请首先将 AssetsLibrary 框架添加到您的 Xcode 项目中:在项目导航器中单击您的项目名称 < 然后在 TARGETS 下单击您的项目名称 < 然后单击 Build Phases < 然后单击 Link Binary With Libraries <然后点击“+按钮”并添加AssetsLibrary.framework
Finally add this import below at the top of your swift class:
最后在 swift 类的顶部添加这个导入:
import AssetsLibrary