Reputation: 419
How can I import file programmatically? For example:
@interface RoomModel : NSObject
#ifdef DEBUG
#import "fileA.h" //error : missing context for method declaration
#else
#import "fileB.h"
#endif
@end
I know what that mean: I should declare the import in front of the interface. But if I want to import the .h
file programmatically? Any ideas? Thanks
Upvotes: 0
Views: 219
Reputation: 20006
You can't import
at runtime, if that's what you're trying to do. It's a preprocessor command, that is executed before compilation.
Upvotes: 3
Reputation: 2668
import statements must be on top
#ifdef DEBUG
#import "fileA.h"
#else
#import "fileB.h"
#endif
@interface RoomModel : NSObject
Upvotes: 3