框架在 Xcode 中是“红色”的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3365114/
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
Frameworks are 'red' in Xcode
提问by Taimur Ajmal
I downloaded a project developed by Apple employees ( who taught course at Stanford on iPhone application development). Strangely , the frameworks are red.
我下载了一个由 Apple 员工开发的项目(他们在斯坦福大学教授 iPhone 应用程序开发课程)。奇怪的是,框架是红色的。
http://img.skitch.com/20100730-kcjun96mp2pxnpg7w3x6njw57.jpg
http://img.skitch.com/20100730-kcjun96mp2pxnpg7w3x6njw57.jpg
I tried to locate coreGraphics.framework and UIKit.framework to add them again but i couldnt find them either.
我试图找到 coreGraphics.framework 和 UIKit.framework 以再次添加它们,但我也找不到它们。
Taimur
泰穆尔
采纳答案by TechZen
The red text indicates that the actual files are not at the path that the project has for them.
红色文本表示实际文件不在项目为其设置的路径中。
Get info on the framework and look under the General
tab. The first section shows the name and path of the framework bundle itself. The most common cause of a problem with system supplied frameworks is that the path type has been changed to something that breaks the path. The default setting is Relative to Current SDK
. Change the path until you get one that leads to the actual framework.
获取有关框架的信息并查看General
选项卡下的信息。第一部分显示框架包本身的名称和路径。系统提供的框架出现问题的最常见原因是路径类型已更改为破坏路径的内容。默认设置是Relative to Current SDK
。更改路径,直到获得通向实际框架的路径。
If you have the developer tools installed in a custom location, you are more likely to run into this problem. If you copy a project from someone with non-standard settings, you can encounter it as well.
如果您在自定义位置安装了开发人员工具,则更有可能遇到此问题。如果您从具有非标准设置的人那里复制项目,您也可能会遇到它。
回答by Michael Peterson
Are you building for a Simulator or for Device?
您是为模拟器还是为设备构建?
Try building for Device.
尝试为设备构建。
回答by jchatard
Found a way to fix this automagically:
找到了一种自动修复此问题的方法:
- Right click your main Xcode project file (the blue one at the top
),
- Get info,
- 'General' tab,
- At the bottom, set 'Base SDK for All configurations' to your desired one.
- 右键单击您的主 Xcode 项目文件(顶部的蓝色文件
),
- 获取信息,
- '常规选项卡,
- 在底部,将“所有配置的基础 SDK”设置为您想要的。
Done!
完毕!
回答by Envil
I had faced this problem before. I got over it by copy the missing (in red) framework from my friend's Mac then copy it to the Framework folder.
我以前遇到过这个问题。我通过从我朋友的 Mac 复制丢失的(红色)框架,然后将其复制到 Framework 文件夹来解决它。
This is the path of my framework folder:
这是我的框架文件夹的路径:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks
You may need to change the path depend on your system or your sdk version.
您可能需要根据您的系统或 sdk 版本更改路径。
回答by ancajic
Most likely you decided to remove some of the frameworks you don't need and you deleted them but selected "Move to Trash" instead of "Remove reference".
很可能您决定删除一些不需要的框架并删除它们,但选择了“移至垃圾箱”而不是“删除引用”。
The problem is that this framework was not included in your project's folder. It sits in a System folder when it can be used by multiple projects. So not only did you cause the current project not to compile, but also all projects on your computer.
问题是此框架未包含在您的项目文件夹中。当它可以被多个项目使用时,它位于系统文件夹中。所以你不仅导致当前项目无法编译,还导致您计算机上的所有项目都无法编译。
If you have any frameworks left, you can right-click on them and check "Show in Finder". Than you can find your deleted frameworks in the trash (if it's not wiped already), and put them back in the system's Frameworks folder.
如果您还有任何框架,您可以右键单击它们并选中“在 Finder 中显示”。然后您可以在垃圾箱中找到已删除的框架(如果尚未擦除),并将它们放回系统的 Frameworks 文件夹中。
If you can't find this folder, for me it was here: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library
如果你找不到这个文件夹,对我来说它在这里:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library
Of course, when you go in Applications folder and select Xcode, you have to right-click on it and click "Show Package Contents".
当然,当您进入 Applications 文件夹并选择 Xcode 时,您必须右键单击它并单击“显示包内容”。
If you deleted your frameworks even from the trash, than I guess you could re-install Xcode...
如果您甚至从垃圾箱中删除了您的框架,那么我想您可以重新安装 Xcode ......
回答by Sivanathan
@Taimur Hamza - Its happen (red color) following any one of reason,
@Taimur Hamza - 它发生(红色)以下任何一种原因,
Your downloaded project may be miss some required files
Before run the application at first time.
so, first you have to find that above reason is happen and try to solve via copy the framework from another running project and paste it your project.
您下载的项目可能缺少一些必需的文件
在第一次运行应用程序之前。
因此,首先您必须找到上述原因发生并尝试通过从另一个正在运行的项目中复制框架并将其粘贴到您的项目中来解决。