可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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!
回答1:
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.)
回答2:
I had the same problem too, Xcode 4.3 can't find Foundation.framework, CoreFoundation.framework and like David Da Silva Contín said, I removed the Xcode 4.3 build 4E109 that was installed over Xcode 4.2 and reinstalled it again, and its everything ok now. Thanks David =D
回答3:
I try delete and reinstall Xcode it's work. Thank.
回答4:
I just had a similar issue.
I had added one of my own .h
files to the .pch
so I didn't have to import it into every class. It was fine until just now when I started to get errors but only when building for a device. The weird thing is that it anyway installed and ran ok on the device and there were never any errors at all on the simulator.
All I did was delete the import line from the .pch
, cmd+S and then tapped my heels together three times and added it back.
I did an option+clean and then it compiled with no problems at all. Very happy to not have to reinstall Xcode and perhaps this will help someone else?
回答5:
May be in Build Settings -> Valid Architecture there are arm64.
So just remove the architecture arm64 and problem solved.
回答6:
Ivan's answer
Check that "Use Standard System Header Directory Searching" (under "Build Settings") is set
to Yes.
For me the "Use Standard System Header Directory Searching" was already set to YES, however I ticked it to NO, then back to YES, and did both a Clean and a Clean Build Folder (Product -> Clean and (ALT) Product -> Clean Build Folder) which seemed to have solved the issue for me.
Now I'm not sure what steps in this process had actually fixed it (I had cleaned the build folder prior to this with no avail), but it worked.
回答7:
UIKit is not for Lion but limited to iOS.
Is your project targetting iOS SDK?
回答8:
I solved it just by reinstalling Xcode.
If something similar happens to you, delete Xcode.app (as it's now just an App), and download it again from the Mac App Store.
I guess it didn't install correctly.
回答9:
To try reinstall your XCode. I lost a lot of time when look for the problem. Then I tried reinstall my XCode because I could not see header files in each frameworks. And that helped me.
回答10:
Check that "Use Standard System Header Directory Searching" (under "Build Settings") is set to Yes.
I accidentally changed that setting and had the same issue also.
回答11:
Removing the project completely and adding everything again has worked for me several times.
回答12:
I experienced the same problem after I cloned my old computer to new one with the migration assistant.
I solved it simply by deleting content of DerivedData folder (/Users/userName/Library/Developer/Xcode/DerivedData).
I guess clean uninstall or installing new version of xCode does the same.