iOS SDK broken ever after reinstall UIKit and Foundation frameworks not found

[亡魂溺海] 提交于 2019-11-27 04:47:54

问题


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 wont 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 OSX ones in an iOS project.

Thank you for any help.


回答1:


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.




回答2:


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:

/Applications/Xcode.app/Contents/Developer/Platforms/_**iPhoneSimulator.platform**_/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/

and device started working when I added this one:

/Applications/Xcode.app/Contents/Developer/Platforms/_**iPhoneOS.platform**_/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/

Thi is for XCode Version 4.5.1 (4G1004).




回答3:


Check to make sure it's not a typo. Have had multiple dependencies misspell UIKit with a capital I like this:

#import <UIKit/UIKIt.h> // typo
#import <UIKit/UIKit.h> // correct

Just check the import carefully and make sure.




回答4:


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.




回答5:


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.




回答6:


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)



来源:https://stackoverflow.com/questions/4008800/ios-sdk-broken-ever-after-reinstall-uikit-and-foundation-frameworks-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!