user979331 user979331 - 6 months ago 35
iOS Question

Objective-C - Expected a type on + function

I am using an SDK from a 3rd party when I use the sample app, I get no errors, when I add the SDK to my app, I get this error:

Expected a type
on this line
+(UIImage *)arrowImage;


I get a bunch of these errors on method definitions like:

+(UIColor *)itemsColor;
+ (UIColor *)mainColor;
+ (UIColor *)itemTextColor;
+ (UIColor *)selectionColor;


Why am i getting these errors for only these methods? PLEASE HELP!

Here it the complete .h file:

#import <Foundation/Foundation.h>

@interface SIMenuConfiguration : NSObject
//Menu width
+ (float)menuWidth;

//Menu item height
+ (float)itemCellHeight;

//Animation duration of menu appearence
+ (float)animationDuration;

//Menu substrate alpha value
+ (float)backgroundAlpha;

//Menu alpha value
+ (float)menuAlpha;

//Value of bounce
+ (float)bounceOffset;

//Arrow image near title
+(UIImage *)arrowImage;

//Distance between Title and arrow image
+ (float)arrowPadding;

//Items color in menu
+(UIColor *)itemsColor;

//Menu color
+ (UIColor *)mainColor;

//Item selection animation speed
+ (float)selectionSpeed;

//Menu item text color
+ (UIColor *)itemTextColor;

//Selection color
+ (UIColor *)selectionColor;
@end

Answer

Replace #import <Foundation/Foundation.h> with @import UIKit. As noted in the comments, UIColor is part of UIKit.