重新安装 UIKit 后 iOS SDK 就损坏了,并且找不到 Foundation 框架
对于 pch 文件,我收到以下错误:
/Users/matt/Programming/iPhone Monkey Curling lite/iPhone_Monkey_Curling_Prefix.pch:6:34:错误:Foundation/Foundation.h:没有这样的文件或目录
/Users/matt/Programming/iPhone Monkey Curling lite/iPhone_Monkey_Curling_Prefix.pch:7:24:错误:UIKit/UIKit.h:没有这样的文件或目录
这是默认情况下的文件:
//
// Prefix header for all source files of the 'iPhone Monkey Curling' target in the 'iPhone Monkey Curling' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
我重新安装了 Xcode 和 iOS SDK,但这并没有解决问题。将 iAd 框架添加到我的一个项目后出现此问题,但我的所有项目都无法编译。
我正在使用最新的 SDK(4.1)。
框架在项目中。由于某种原因,当我尝试添加新框架时,它会列出 iOS 项目中的 OS X 框架。
感谢您的帮助。
For the pch file I get these errors:
/Users/matt/Programming/iPhone Monkey Curling lite/iPhone_Monkey_Curling_Prefix.pch:6:34: error: Foundation/Foundation.h: No such file or directory
/Users/matt/Programming/iPhone Monkey Curling lite/iPhone_Monkey_Curling_Prefix.pch:7:24: error: UIKit/UIKit.h: No such file or directory
Here's the file as it is by default:
//
// Prefix header for all source files of the 'iPhone Monkey Curling' target in the 'iPhone Monkey Curling' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
I reinstalled Xcode and the iOS SDK but that did not fix the problem. This problem occurred after adding the iAd framework to one of my projects but all of my projects won't compile.
I'm using the latest SDK (4.1).
The frameworks are there in the project. For some reason, when I try to add a new framework, it lists the OS X ones in an iOS project.
Thank you for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在苹果开发者论坛上,我设法获得了定位问题的帮助。事实证明,构建选项不知何故被设置为奇怪的东西。
这是“框架搜索路径”选项。如果有人遇到类似问题,请确保此为空。
On the Apple developer forums I managed to get help on pin-pointing the issue. It turns out somehow a build option was set to something odd.
It was the "Framework Search Paths" option. Make sure this is empty if anyone has a similar problem.
我想补充一下 Matthew 的答案:
实际上,框架搜索路径不应该为空,但它应该只包含 SDK 的 Frameworks 文件夹的路径。在我的例子中,模拟器使用此路径:
当我添加此路径时,设备开始工作:
Thi 适用于 XCode 版本 4.5.1 (4G1004)。
I'd like to add to the Matthew's answer:
Actually, the Framework Search Paths shouldn't be empty, but it should include only the paths to the SDK's Frameworks folders. In my case simulator worked with this path:
and device started working when I added this one:
Thi is for XCode Version 4.5.1 (4G1004).
检查以确保它没有拼写错误。有多个依赖项将
UIKit
拼写为大写I
,如下所示:只需仔细检查导入并确保。
Check to make sure it's not a typo. Have had multiple dependencies misspell
UIKit
with a capitalI
like this:Just check the import carefully and make sure.
这在 xcode 4 中发生在我身上,它可以很好地进行调试,但不能发布。与您的修复类似,发布的前缀标头指向 UIKit.h 而不是我的 .pch 文件。
This happened for me in xcode 4, it would build fine for debug but not release. Similar to your fix, the prefix header for release was pointing to UIKit.h instead of my .pch file.
这发生在我身上。我不太熟悉 Mac 的“Finder”。它的工作方式与 Windows 资源管理器不太一样。我想向我的项目添加几个图像文件,在导航到文件夹时,我不小心双击了 Developer 文件夹,这向我的项目添加了超过 8,500 个文件。我认为只需从我的项目中删除该文件夹就足够了,但我不知道它会更改搜索路径。确实如此,事实上,它还改变了我的图书馆搜索路径。两个都删了,又好了。但在经历了巨大的情感痛苦之前。
我添加此内容只是为了让人们知道问题是如何出现在我身上的。类似的事情是非常容易的。
This happened to me. I am not very good with the Mac's "Finder." It doesn't work quite the same as Windows Explorer. I was wanting to add a couple of image files to my project, and navigating my way to the folder I accidentally double-clicked on the Developer folder, which added over 8,500 files to my project. Thinking it would be sufficient to just remove the folder from my project, I didn't know that it would change search paths. It did, and in fact, it also change my Library search path. Deleted both, and I'm good again. But not before a great deal of emotional agony.
I add this only to let people know how the problem cropped up for me. Something like that is insidiously easy.
xcode 5(开发者预览版)遇到了这个问题。我尝试了一切,包括这些答案 - Availability.h、UIKit.h 等不找到了
但没有任何效果。
我的修复方法是重新安装 xcode(从开发者门户再次下载并替换旧的)
got this problem with xcode 5 (developer preview). i tried everything, including these answers - Availability.h, UIKit.h, etc not found
but nothing works.
my fix was reinstalling xcode (downloading again from developer portal and replace the old one)