Reputation: 8720
I have a method in a custom FileIO (Input/Output) class with this definition:
- (void)saveObject:(NSObject*)object;
I have another class named MyClass that has a property:
@property (nonatomic, strong) MyDataClass* myData; // subclassed from NSObject
I try to call the method with the property:
[fileIO saveObject:self.myData];
For some reason, I get a semantic warning:
Incompatible pointer types sending 'MyDataClass *' to parameter of type 'NSObject *'
Upvotes: 0
Views: 51
Reputation: 318804
Given that MyDataClass
does in fact extend NSObject
, the issue may arise if this .m file does not import (directly or indirectly) the .h for MyDataClass
. If all it has seen is a forward declaration (via @class
), the compiler doesn't yet know that MyDataClass
extends NSObject
.
Import the .h for MyDataClass
and it should solve the problem.
Upvotes: 1