Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NS_ENUM - function definition is not allowed here

Tags:

ios

I am receiving the error function definition is not allowed here on all three enums. I recently updated to Xcode 6.0.1 and I am receiving that error now. How can I fix this error, should I avoid using this macro. I have also set the target SDK to ios 6.0 which supports these macros.

BConstants.h

#ifndef asdf_BPConstants_h
#define asdf_BPConstants_h


typedef NS_ENUM(NSUInteger, BTheme) {
    kField
};

typedef NS_ENUM(NSUInteger, BItem) {
    kBox
};

typedef NS_ENUM(NSUInteger, BMovementState) {
    kTouchUp,
    kTouchDown
};

#endif
like image 991
Michael Avatar asked Sep 20 '14 20:09

Michael


2 Answers

Importing UIKit fixed this for me.

#import <UIKit/UIKit.h>
like image 131
MLQ Avatar answered Nov 10 '22 22:11

MLQ


Importing Foundation should be enough.

@import Foundation;
like image 28
Antonio Favata Avatar answered Nov 10 '22 23:11

Antonio Favata