ios Xcode 6:项目导航器中没有 Frameworks 文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26451861/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 03:15:05  来源:igfitidea点击:

Xcode 6: No Frameworks Folder in Project Navigator

iosframeworksxcode6project-navigator

提问by cheznead

I am using Xcode 6 and following an Xcode version 4 tutorial so things are different here and there.

我正在使用 Xcode 6 并遵循 Xcode 版本 4 教程,因此这里和那里的情况有所不同。

There doesn't seem to be a Frameworks folder in my project navigator and so when I downloaded some .framework files and added them manually in the build phase of my project editor, I had no Frameworks folder to save them in and just let them fall into the top of my project navigator. So they are there, just not in a special folder, and it doesn't look good.

我的项目导航器中似乎没有 Frameworks 文件夹,所以当我下载了一些 .framework 文件并在我的项目编辑器的构建阶段手动添加它们时,我没有 Frameworks 文件夹来保存它们,让它们掉下来进入我的项目导航器的顶部。所以它们在那里,只是不在一个特殊的文件夹中,而且看起来不太好。

So should Xcode 6 have a frameworks folder automatically, or do I need to create one myself? And if so, how can I do that? (I've only added new files so far).

那么 Xcode 6 应该自动有一个框架文件夹,还是我需要自己创建一个?如果是这样,我该怎么做?(到目前为止,我只添加了新文件)。

回答by Sebyddd

In Xcode 6, the Frameworks folder is not added by default. You can drag and drop your .framework files into the project navigator (tick 'Copy items if needed'), then select them all > right click > "New Group from Selection"and name the folder 'Frameworks'.

在 Xcode 6 中,默认情况下不添加 Frameworks 文件夹。您可以将您的 .framework 文件拖放到项目导航器中(勾选“如果需要,请复制项目”),然后将它们全部选中 > 右键单击​​ >“从选择中新建组”并将文件夹命名为“框架”。

Also, make sure the frameworks are added into the Project > Build Phases > Link Binary With Libraries. If not, drag them there from your newly created 'Frameworks' folder.

此外,请确保将框架添加到Project > Build Phases > Link Binary With Libraries 中。如果没有,请将它们从新创建的“Frameworks”文件夹中拖到那里。

回答by Quintin Willison

In short, no, you shouldn't need to create a Frameworks groupyourself as Xcode is doing stuff automatically for you...

简而言之,,您不需要自己创建一个框架组,因为 Xcode 会自动为您做一些事情......

Apple are slowly, gently pushing developers in the direction of newer Clangfeatures with the goal of making native iOS development more approachable for newbies who don't have previous experience of compiling and linking with C-based languages.

Apple 正在缓慢、温和地推动开发人员开发更新的Clang功能,其目标是让原生 iOS 开发对于之前没有编译和链接基于 C 语言的经验的新手来说更容易上手。

You'll find that Objective-C projects created with Xcode 6 have new build settings enabled by default including Link Frameworks Automatically(CLANG_MODULES_AUTOLINK) and Enable Modules (C and Objective-C)(CLANG_ENABLE_MODULES).

您会发现使用 Xcode 6 创建的 Objective-C 项目默认启用了新的构建设置,包括自动链接框架( CLANG_MODULES_AUTOLINK) 和启用模块 (C 和 Objective-C)( CLANG_ENABLE_MODULES)。

Suggested reading:

推荐阅读:

回答by stevebot

I found the other answers too confusing (where am I supposed to get .framework files?)

我发现其他答案太混乱了(我应该在哪里获得 .framework 文件?)

It's way simpler in Xcode 6. Just go to Capabilities and turn Maps on. That's it... really.

在 Xcode 6 中它更简单。只需转到 Capabilities 并打开 Maps。就是这样……真的。

回答by yoAlex5

I would recommend using drag and dropfeature to move files into Xcode. Xcode show you the Choose options for adding these fileswindow [Copy items if needed][Added folders]

我建议使用drag and drop功能将文件移动到 Xcode。Xcode 向您Choose options for adding these files显示[Copy items if needed] [Added folders]窗口

For example Xcode can automatically add relative path ($(PROJECT_DIR)/) to:

例如 Xcode 可以自动添加相对路径 ( $(PROJECT_DIR)/) 到:

  • Build Settings -> Library Search Pathsif you drag and dropa library
  • Build Settings -> Framework Search Pathsif you drag and dropa framework
  • Build Settings -> Library Search Paths如果你drag and drop是图书馆
  • Build Settings -> Framework Search Paths如果你drag and drop是一个框架