隐式转换会丢失整数精度:'NSInteger'(又名 'long')到 'int'

Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'

我正在尝试构建一个项目来分发此应用程序。 但是 - 这个应用程序,太旧了。 所以,我正在使用 Xcode 8.3.3 和 IOS Sierra。

我遇到的不是这个问题 SistemaCardapio/SistemaCardapioAppDelegate.m:60:28:隐式转换会丢失整数精度:'NSInteger'(又名 'long')到 'int'

ARC - 为所有需要的构建项目停用。

我已经尝试处理它,亲手处理,但是要修复的项目太多了。

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;

我想删除此警告,并在 Xcode 上编译项目。

警告非常明确:timeOutParaImpressao 在 64 位机器上声明为 int,这是一个 32 位整数,integerForKey returns 是一个 64 位整数。

解决方案:将 timeOutParaImpressao 声明为 NSInteger

NSInteger timeOutParaImpressao = 0;

认真对待警告并修复它们。