4
#import <Foundation/Foundation.h>

@interface FaceObject : NSObject

@property (strong, nonatomic) UIImage *image;

@end

Xcode gives an error saying "unknown type name 'UIImage' unless I import UIKit.h, but in Xcode 5 i would have not gotten this error and did not need to import UIKit -- is there any explanation for this? Am I doing something wrong? Thanks!

luna_
  • 312
  • 3
  • 15
  • Check your PCH, clean or deep clean your project, erase derived data, quit and relaunch Xcode... There are many cases where Xcode loses its "import chain". – Cyrille Oct 09 '14 at 18:32

2 Answers2

8

In 2015 -- still getting this error. I always forget to include

#import <UIKit/UIKit.h> 

That should take care of it.

TheRealRonDez
  • 2,807
  • 2
  • 30
  • 40
2

Xcode 6 no longer includes a .pch file by default. In previous versions, that file included the UIKit import (more info here - Why isn't ProjectName-Prefix.pch created automatically in Xcode 6?).

Community
  • 1
  • 1
ryanipete
  • 419
  • 5
  • 15