iphone - how to declare UInt32 variable with global class access -


i trying declare uint32 variable can accessed method in class..

so global classes methods not other class...

i trying in .h

@interface enginerequests : nsobject {      uint32 dataversion; }  @property (copy) uint32 dataversion; 

but thats not working.. i'm getting error on line @property etc.. need or fine use uint32 @ top.

you try

@interface enginerequests : nsobject { @protected    uint32 dataversion; }  @property (assign) uint32 dataversion; @end  @implementation enginerequests  @synthesize dataversion;  // methods can access self.dataversion  @end 

but don't need property, unless want grant/control outside access. declare uint32 dataversion in class interface , reference dataversion in implementation without self. either way, @protected prevent outside classes accessing dataversion directly.

have read on objective-c properties?

initialization

your enginerequests subclass of nsobject. such, can (usually should) override nsobject's -(id)init method, such:

-(id)init {    self = [super init];    if (self != nil) {       self.dataversion = 8675309; // omit 'self.' if have no '@property'    }    return self; } 

or create own -(id)initwithversion:(uint32)version;.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -