@property (retain) int myInteger;
That throws me an error because apparently int
is not considered an object... but I want to get the advantage of creating a getter/setter method with the @synthetize
thing, but with an int
. How could I achieve so? Is there an equivalent?
@property (assign) int chunkID;
or
@property (readonly) int chunkID;
You cannot retain a primitive type like integers. Only objects can be retained...
Use this:
@property (nonatomic, assign) int chunkID;
assign
is the default so you might want to leave it out.
You need to use the assign
type of property because you are dealing with a primitive object type (i.e. int). This kind of type can't be retained.
Only subclasses of NSObject can be retained / released.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With