ios 将框架添加到 Xcode 5 中的项目并添加 *relative* 路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19109085/
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
Adding frameworks to project in Xcode 5 and having *relative* paths added
提问by Jonny
All of a sudden today I get an unexpected problem with Xcode (5).
今天突然间我遇到了 Xcode (5) 一个意想不到的问题。
This is how I normally add an external framework:
这是我通常添加外部框架的方式:
Drag-n-drop the file (xxx.framework etc) (or the folder which contains the file) into the project manager. In "Choose options for adding files" I check "Copy items into destination (if needed)" only if needed (if the files are already in the project's folder I don't do this) In "Folders" I select Create groups for any added folders And I add it to my app target.
将文件(xxx.framework 等)(或包含文件的文件夹)拖放到项目管理器中。在“选择添加文件的选项”中,我只在需要时选中“将项目复制到目标(如果需要)”(如果文件已经在项目的文件夹中,我不会这样做)在“文件夹”中,我选择为任何创建组添加文件夹 我将它添加到我的应用程序目标。
Normally this would also add the relativepath(s) to the framework in Build Settings/Framework Search Paths and Library Search Paths.
通常这也会在构建设置/框架搜索路径和库搜索路径中添加框架的相对路径。
However today the path that shows up there is direct(aka absolute). This breaks stuff down the line because the paths should be relative. How come Xcode does this all of a sudden? I suspect it might have to do with this one project only (it comes from a 3rd part dev) and something about their project setup could be causing this.
然而,今天出现的路径是直接的(也就是绝对的)。这打破了路线,因为路径应该是相对的。Xcode 怎么会突然这样做?我怀疑它可能只与这个项目有关(它来自第 3 部分开发),并且他们的项目设置可能会导致这种情况。
回答by Gautam Jain
I faced the same issue. There is a simple fix. Go to framework search paths. Remove everything from there. Add ./ and make it recursive. That's it.
我遇到了同样的问题。有一个简单的修复。转到框架搜索路径。从那里删除所有内容。添加 ./ 并使其递归。就是这样。
回答by EhTd
I am having the same problem on XCode 5, so far the best solution is to modify the path of your framework search.
我在 XCode 5 上遇到了同样的问题,到目前为止最好的解决方案是修改框架搜索的路径。
Go to your project
转到您的项目
Build settings->Framework search path
构建设置->框架搜索路径
Add the relative path to your framework.
将相对路径添加到您的框架。
If it was correctly copied now you can modify the path, to something like this:
如果它现在被正确复制,您可以修改路径,如下所示:
./MyProject/Libraries/ACoolLibrary
./MyProject/Libraries/ACoolLibrary
Supposing a file structure like this:
假设文件结构是这样的:
-MyProject.xcodeproj
-MyProject
--Libraries
-----ACoolLibrary
-------- TheCoolLibrary.framework
-MyProject.xcodeproj
-我的项目
--图书馆
-----A酷图书馆
-------- TheCoolLibrary.framework