NSString *msg = [[NSString alloc]initWithFormat:@"Hello %s, What do you do", (self.isUser ? @"User" : @"Guest")];
NSLog(msg);
When I print the msg, it show that this is "†¶·»,", instead of user/guest, what's happen?
NSString *msg = [[NSString alloc]initWithFormat:@"Hello %s, What do you do", (self.isUser ? @"User" : @"Guest")];
NSLog(msg);
When I print the msg, it show that this is "†¶·»,", instead of user/guest, what's happen?
You need to use "%@" instead of "%s" on your format string if you are using NSString instances. Like this:
NSString *msg =
[[NSString alloc]initWithFormat:@"Hello %@, What do you do", (self.isUser ? @"User" : @"Guest")];