I have an init method defined as:
- (id)initWithX:(float)inX AndY:(float)inY
{
if (self = [super init])
{
[self setX:inX andY:inY];
}
return self;
}
When I use this method as follows:
MyObject* myObject = [[MyObject alloc] initWithX:0.0 AndY:0.0];
I get a warning: "warning: initialization from a separate Objective-C type"
But interestingly, if I changed “AndY:” to “andY:” in the method signature, the warning disappears.
Why is this happening? Of course, naming my method should not affect its return type?
After a little research, changing the method name, use the lowercase "andY" so that the warning does not disappear. I cleared all the goals and rebuilt, and the warning did not appear. But he returned after another recompilation. Odd
source
share