So I am unable to understand this error.
I have an object with these properties
@property (nonatomic, readwrite) double width;
@property (nonatomic, readwrite) double height;
When I am creating an NSSdictionary add adding them into it
if (config.width) {
properties[@"height"] = config.height;
}
if (config.height) {
properties[@"height"] = config.height;
}
I am getting following error
Sending ‘double’ to parameter of incompatible type ‘id _Nullable’
If I am correct, type id
is equivalent to any? which includes double
. Also, I am setting value if it exist?
2
Answers
Just in case if anyone wants to know how I was able to fix it, I did
[NSNumber numberWithDouble:config.height];
But you’re not correct.
id
is equivalent to any object (an NSObject subclass).double
is not an object; it’s a primitive.