Not all variables in Objective C have to be declared with the *
character as some newcomers to the language think. It is C legacy to show that the variable is a pointer to an object. Some basic types like int
and BOOL
are too simple to require the overhead of storing them in an object, so C-style primitive types are used. From the docs:
Scalar types are used in situations where you just don’t need the
benefits (or associated overheads) of using an object to
represent a value. While strings of characters are usually represented
as instances of the NSString class, numeric values are often stored in
scalar local variables or properties.
BOOL is a primitive data type in Objective C and is not supposed to be a pointer. The warnings are correct. Declare the variable like this:
@property (nonatomic) BOOL done;
Note the lack of the *
character next to the variable name. Other primitive types like int
or float
also should be declared in a similar fashion.
Some other things about your code. The correct Objective C convention for BOOL values is YES
instead of TRUE
and NO
instead of FALSE
, so you should stick to it. Also, since Xcode 4.4, you don't need @synthesize
outside of a few special cases described here. As pointed out in the comments, it's also better to use instancetype
instead of id
in your case as described in the docs.