Rendy
Rendy

Reputation: 5698

Extern constant - Property not found on object of type

I try to declare constant to be publicly accessible.

SortType.h

extern NSInteger const ASCENDING;
extern NSInteger const DESCENDING;

SortType.m

NSInteger const ASCENDING = 100;
NSInteger const DESCENDING = 101;

ViewController

#import "SortType.h"
...
SortType.ASCENDING;

But it has following error:

Property 'ASCENDING' not found on object of type 'SortType'

What could be wrong?

Upvotes: 0

Views: 176

Answers (1)

Midhun MP
Midhun MP

Reputation: 107181

The ASCENDING is not a property of SortType class, it's a extern constant. So you can't use like:

SortType.ASCENDING;

Just use:

NSInteger myInteger = ASCENDING;

Upvotes: 1

Related Questions