隐式转换失去整数精度



任何人都可以帮我我正在设置UM Pushwoosh,并且我会遇到此错误

/pushnotificationmanager.m:43:111:隐式转换失去整数精度:'nsinteger'(aka'long')to'int'

NSInteger在64位系统上比int具有更大的尺寸(等于long)。警告告诉您,将NSInteger转换为int时可能会丢失信息。您可以通过与(int)打字来抑制警告,但是由于精确损失,您可能会突然发现奇怪的计算。最好将NSInteger代替int用于所有整数变量。另请参阅何时使用NSINTEGER与INT进行更多讨论。

隐式与显式:

NSInteger myLong = 11234;
int myInt = myLong; // implicit
int myInt2 = (int)myLong; // explicit by typecasting; you should know why you do this.

最新更新