Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
649 views
in Technique[技术] by (71.8m points)

iphone - Availability.h, UIKit.h, etc not found

I'm having a great problem here.

I recently downloaded Xcode 4.3 from the Mac App Store, because it had the full-screen feature for Lion. And then, my project stopped compiling. It says:

Lexical or Preprocessor Issue Availability.h file not found.

//
// Prefix header for all source files of the 'TRGame' target in the 'TRGame' project
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif


#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif

That's in the xxxx-Prefix.pch file.

If I comment out the #import Availability.h, it will tell me that it can't find the UIKit.h, and so on...

Help will be MUCH appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I hate this problem! There seems to be a simple solution that SOMETIMES works:

Possible solution

Go to Build Phases -> Link Binary With Liibraries.

If you are having a problem with say Foundation.framework. Simply delete that one --- i.e., use the minus ("-") button at the bottom of the list.

And then add it again, using the plus button.

Clean the build folder. (To do so hold down ALT, then click Product -> Clean. You will see "Clean" changes to "Clean Build Folder")

Another possible solution

Be sure to read Matthew's answer here ...

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

Look at the value of your "Framework Search Paths".

Another possible solution

Completely and totally uninstall XCode 4.3, use "CleanMyMac" to do so (it will try to find every associated component of the app you are trying to delete).

Then just use the App Store to (re) install XCode. As David mentions, this can sometimes fix this damn problem.

Why does it happen?...

I believe this problem can possibly happen in situations where you have, say, replaced your hard drive (i.e., probably using Carbon Copy Cloner or the like) or in some way the main volume on your Mac gets renamed or changed in some way. I think there might be a slight bug in the new "application-style" Xcode where it sometimes does and sometimes does not understand that sort of change in the paths.

I hope it helps someone!

It is an infuriating problem. I just had it happen again, in this case, because I subsequently deleted a copy of the "old-style" XCode from a machine. (It's perhaps better to utterly delete old-style XCodes (/Developer directory, etc) before installing the new-style XCode.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...