How to use a boolean property in objective C class, i did it like:
@property (nonatomic, copy) BOOL *locationUseBool;
but it gives error that:
Property with 'copy' attribute must be of object type.
what is the correct way of declaring?
How to use a boolean property in objective C class, i did it like:
@property (nonatomic, copy) BOOL *locationUseBool;
but it gives error that:
Property with 'copy' attribute must be of object type.
what is the correct way of declaring?
You can declare this way also.
@property (assign) BOOL locationUseBool;
Basically, if you say nonatomic, and you generate the accessors using @synthesize, then if multiple threads try to change/read the property at once, badness can happen. You can get partially-written values or over-released/retained objects
In a multi-threaded program, an atomic operation cannot be interrupted partially through, whereas nonatomic operations can.
@property (nonatomic, assign) BOOL locationUseBool;
No asterisk, no copy, no retain.
This one worked for me.
@property (nonatomic) BOOL locationUseBool;
There is not asterisk * symbol in property declaration. Also, use of 'assign' is optional.