Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode formatting compiler warning: Format specifies type 'unsigned short' but the argument has type 'int'

It's a tad OCD, but I hate getting any compiler warnings. When I updated XCode, I started getting this compiler warning:

Format specifies type 'unsigned short' but the argument has type 'int'

When I tried including the Unicode character for degree using the following code:

currentVal = [NSString stringWithFormat:@"%.2f%C", angleDeg, 0x00B0];

How do I make the compiler warning go away, either by changing the code or turning off that particular compiler warning?

like image 877
NSConfusedCoder Avatar asked Aug 08 '12 20:08

NSConfusedCoder


1 Answers

Cast the literal to unichar:

currentVal = [NSString stringWithFormat:@"%.2f%C", angleDeg, (unichar)0x00B0];
like image 171
trojanfoe Avatar answered Nov 19 '22 08:11

trojanfoe