I get a warning: incompatible Objective-C types assigning 'struct NSString *', expected 'struct NSMutableString *'

I get a warning: incompatible Objective-C types assigning 'struct NSString *', expected 'struct NSMutableString *' on this line: -

 Value = [Value stringByAppendingString:str];

I declared the value as

 NSMutableString* Value;

How to fix it?

+3
source share
1 answer

With, NSMutableStringyou can (and should) just do the following:

[Value appendString:str];

-stringByAppendingString does return an instance of NSString, even if it was called in NSMutableString and converting it back to mutable will lead to performance degradation and code degradation.

P.S. , objective-c .

+4

Source: https://habr.com/ru/post/1758188/


All Articles