views:

3079

answers:

1

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?

+19  A: 

The qualifier you’re missing is const. -UTF8String returns a const char *, so str should also be declared const char *.

Ahruman