why will the following code not append one string to the other?

NSString is immutable, you’d need to use an instance of NSMutableString in order to be able to append to it.

NSMutableString *s  = [[NSMutableString alloc] initWithString:@"hello"];  
[s appendString:@"there"];  

Alternatively you could replace the instance using stringByApendingString:.

Browse More Popular Posts

Leave a Comment