Code:
@property (nonatomic, retain) BOOL val;
Error:
Property with ‘retain(or Strong)’ attribute must be of object type
I want to use this bool object in another class. I am creating it in .h file
Code:
@property (nonatomic, retain) BOOL val;
Error:
Property with ‘retain(or Strong)’ attribute must be of object type
I want to use this bool object in another class. I am creating it in .h file
BOOL is a primitive type (thus not a pointer, so no memory management).
You declare the property this way :
@property (nonatomic) BOOL val;
(you can also explicitly write assign instead of strong/retain)
Use the assign
attribute, which is the default for BOOL
anyway:
@property (nonatomic, assign) BOOL val;