问题
The compiler complains about this, after I activated all kind of warnings:
I create an NSNumber like this:
NSNumber *num = [NSNumber numberWithBool:YES];
warning: passing argument 1 of 'numberWithBool:' with different width due to prototype
it complains about the value I provided. What's wrong with "YES"? What does that mean?
回答1:
It means that you have turned on one of the über-anal warnings about type coercion related to size changes. The compiler is complaining -- likely erroneously, from what I can tell -- that YES is being converted from one width to another -- from 8 bits to 32, most likely.
Turn off that particular warning. There are a number of compiler warnings that have grown to be effectively useless over the years.
回答2:
Try removing -Wconversion, or if that's not there, adding -Wno-conversion
回答3:
Remove -Wconversion
See man (1) gcc
来源:https://stackoverflow.com/questions/1372268/warning-passing-argument-1-of-numberwithbool-with-different-width-due-to-pro