Reputation: 99
I've read the other question in regards to lexical and preprocessor issues and I've tried to use what helped solve their problems. Unfortunately, none of those solutions have helped rectify the problem. This error came out of nowhere and I'm not sure what I can do, other than what read, to fix this. Please help!
Here is the code in which I get the error:
#import <UIKit/UIKit.h>
@interface scanshootViewController : UIViewController
<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
{
IBOutlet UIImageView *imageView;
UIImagePickerController *imagePicker;
}
@property (nonatomic, retain) UIImageView *imageView;
-(IBAction) btnClicked:(id) sender;
@end
Upvotes: 1
Views: 10389
Reputation: 908
FWIW, I had a similar issue trying to improve some code found on github.
I did not understand why it could not find UIColor
and could not #import <UIKit/UIKit.h>
until I realized it was building for OSX, not for iOS!!!
So I put this at the beginning of the .h file:
#import "TargetConditionals.h"
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#import <UIKit/UIKit.h>
#define HXColor UIColor
#else
#import <Cocoa/Cocoa.h>
#define HXColor NSColor
#endif
@interface HXColor (HexColorAddition)
HTH
Upvotes: 0
Reputation: 49384
I was having the same issue with a framework target, building for iOS. I solved this by setting the "Base SDK" in my build configs to something reasonable.
Upvotes: 1
Reputation: 1184
Got to the Frameworks Folder at your project, right click at UIKit.Framework > show in finder.
If the Headers folder is empty that means that you don't have the correct files, I just realized that some Clean Apps remove .h files from your computer (... yes, believe it or not);
Solution:
1) Copy the entire iPhoneOS.platform & iPhoneSimulator.platform folders from other XCode Installation
2) Reinstall XCode (ups...)
Upvotes: 1
Reputation: 1785
I encountered the same problem. The cause was that I accidentally set the "Base SDK" in "Build Settings" to "Current OS X" instead of "Latest iOS". When I set it back to "Latest iOS" the build error disappeared.
Upvotes: 0
Reputation: 41652
Try removing the "Derived Data" folder for your app - you can find it in the Projects tab of the organizer. One you get there in the finder, close the project in Xcode, delete the folder, reopen the project, and try to build. If that does not do it close project, remove every directory in your project file that starts with your userID (or just rename them), reopen, rebuild.
EDIT: a few more suggestions
1) Look at the Target's "Use Standard System Header Directory Searching" and make sure its YES.
2) In your .pch file, you should have something like:
#import <Availability.h>
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
Try adding "Hello" on a line by iteslf under OBJC to verify that when you build, you get here (and get a fatal error) - this will prove whether OBJC is defined.
3) Create a totally new project - iOS one view. Make sure it builds and runs (if not Xcode is frogged). Then open that project Build Settings along side your projects', and look line by line top see what is different.
4) If all else fails, move your project to a different directory, create a new one, then add all the files back into the new project. This is obviously the worst possible solution.
Upvotes: 1