I am learning objective-c
and as i am trying to pass a parameter to a method RequestExecuteCountLettersForString
that accepts data of type NSMutableString
i received a warning.
i am passing the textual parameter as follows:
[delegatee RequestExecuteCountLettersForString:@"XYZ"];
and I am receiving this warning:
Incompatible pointer types sending 'NSString *' to parameter of type
'NSMutableString *'
please let me know how to fix this warnign and why i cant pass such textual input to the method.
The literal @"XYZ"
is not an NSMutableString
. It's an NSString
. That is what the error is telling you.
You need to pass an actual mutable string.
NSMutableString *str = [NSMutableString stringWithString:@"XYZ"]; // or [@"XYZ" mutableCopy];
[delegatee RequestExecuteCountLettersForString:str];
Two things:
NSMutableString
instead of NSString
.