[英]Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'
I'm trying to build a project to distribute this app.我正在尝试构建一个项目来分发此应用程序。 But - this application, is too old from far.但是 - 这个应用程序太老了。 So, i'm using Xcode 8.3.3 and IOS Sierra.所以,我使用的是 Xcode 8.3.3 和 IOS Sierra。
Instead of this i'm having the problem SistemaCardapio/SistemaCardapioAppDelegate.m:60:28: Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'而不是我遇到了问题 SistemaCardapio/SistemaCardapioAppDelegate.m:60:28: 隐式转换失去整数精度:'NSInteger' (aka 'long') to 'int'
ARC - Desactivated for all build items needed. ARC - 停用所有需要的构建项目。
I've tried to work on it, doing hand to hand, but is too many items to fix.我试图解决它,手把手地做,但是要修复的项目太多。
int timeOutParaImpressao = 0;
timeOutParaImpressao = [preferencias integerForKey:@"timeout_impressao"];
if (timeOutParaImpressao == 0) {
NSLog(@"sem timeout pra impressao definido");
timeOutParaImpressao = 20;
[preferencias setInteger:timeOutParaImpressao forKey:@"timeout_impressao"];
}
configuracoes.timeOutImpressao = timeOutParaImpressao;
I Would like to remove this warnings, and compile the project on Xcode.我想删除此警告,并在 Xcode 上编译项目。
The warning is pretty clear: timeOutParaImpressao
is declared as int
which is a 32 bit integer and integerForKey
returns a 64 bit integer on 64 bit machines.警告很清楚: timeOutParaImpressao
被声明为int
,它是一个 32 位整数, integerForKey
在 64 位机器上返回一个 64 位整数。
Solution: Declare timeOutParaImpressao
as NSInteger
解决方案:将timeOutParaImpressao
声明为NSInteger
NSInteger timeOutParaImpressao = 0;
Take warnings seriously and fix them.认真对待警告并修复它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.