objc warning: “discard qualifiers from pointer target type”
When compiling this:
char *str = [[NSString stringWithFormat:@"%i days and %i hours", days, hours] UTF8String];
I get this warning:
initialization discards qualifiers from pointer target type
How do I get rid of it?
The qualifier you’re missing is const. -UTF8String returns a const char *, so str should also be declared const char *.