This is because the @"Hello"
syntax always makes an instance of NSString
, regardless of the type of pointer you declare on the left hand side of the =
operator.
So those two samples are equivalent to:
NSString *string = [NSString new];
and
NSMutableString *string = [NSString new];
That is, the actual object you are creating is an immutable string object in both cases, and the compiler is warning you that you have declared a reference to a mutable string object, but then made it refer to an immutable string object.
Does that help?