Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Photo Browser iPhone App Gestures Refactoring Networking Code

thomas krueger
thomas krueger
3,465 Points

Photo Bombers - Parse Issue UIImage

PhotoController.h

@interface PhotoController : NSObject

  • (void)imageForPhoto:(NSDictionary *)photo size:(NSString *)size completion:(void(^)(UIImage *image))completion;

@end

Generates error - Parse Issue Unknown type name 'UIImage'

which then triggers alert in implementation file - semantic issue, conflicting parameter types in implementation of imageForPhoto:size:completion:':'void(^strong)(int *)' vs 'void(^strong)(UIImage *__strong)'

3 Answers

thomas krueger
thomas krueger
3,465 Points

OK - project did not have a PrefixHeader.pch, so UIKit was not automatically imported into Photocontroller, leading to UIImage not being recognized.

Trevor Duersch
Trevor Duersch
9,964 Points

I get an error that says "Unknown type name 'UIImage'".

I'm using XCode 6.3.2

I tried importing the UIKit library and I'm still getting the error in the header file.

Alberto Huerdo
Alberto Huerdo
2,650 Points

@Trevor, just add

#import <UIKit/UIKit.h>

below

#import <Foundation/Foundation.h>
Trevor Duersch
Trevor Duersch
9,964 Points

Thanks Alberto! That worked like a charm and I was able to finish the app! :)