Student
Student

Reputation: 408

Declare NSString in .h file - Objective c

This may sound like a silly question, but I can'f find easily any solution online.

How to declare a NSString in .h file?

I have tried this:

@property (nonatomic, retain) NSString *DATABASE_NAME;

but I get an error:

Expected member name or ';' after declaration

What's the problem here?

EDIT

My header file:

@interface GlobalVariables : NSObject

    @property BOOL MAP_SATELLITE_VIEW;
    @property (nonatomic, retain) NSString *DATABASE_NAME;

+ (GlobalVariables*)sharedInstance;

@end

Upvotes: 2

Views: 865

Answers (1)

meaning-matters
meaning-matters

Reputation: 22946

There's nothing wrong with the code you show, so you must look in its context. Some ideas:

  • Check how/where #import the .h file.
  • Check if DATABASE_NAME been defined elsewhere.
  • What happens if you replace this line with something else, for example: @property (nonatomic, assign) NSInteger dummyInt;, or add this above that line?

Upvotes: 2

Related Questions