编译时:
char *str = [[NSString stringWithFormat:@"%i days and %i hours", days, hours] UTF8String];
我收到这个警告:
initialization discards qualifiers from pointer target type
我怎么摆脱它?
你缺少的资格赛是const
.-UTF8String
返回一个const char *
,所以str
也应该声明const char *
.