简体   繁体   English

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

[英]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.

相关问题 Xcode 8.0 beta 6,隐式转换失去整数精度:从'NSInteger'(aka'long')到'CGSWindow'(aka'int') - Xcode 8.0 beta 6, Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'CGSWindow' (aka 'int') 如何删除100个警告“隐式转换失去整数精度:'NSInteger'(又名'long')到'int'”我在更新到arm64后得到了什么? - How to remove 100s of warnings “implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'” I got after updating to arm64? 值转换问题:隐式转换失去整数精度:'size_t'(又名'unsigned long')到'int' - Value Conversion issue: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' 隐式转换在制作应用程序时将整数精度'NSUInteger'(aka'unsigned long')转换为'int'吗? - implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' when making app? 隐式转换将整数精度'NSUInteger'(aka'unsigned long')丢失为'int'警告? - implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' warning? Objective-C 隐式转换失去整数精度 'NSUInteger'(又名 'unsigned long')到 'int' 警告 - Objective-C implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int' warning 当我加密字符串时,我得到隐式转换会失去整数精度:'unsigned long'到'CC_LONG'(aka'unsigned int') - When I encrypt the String I get Implicit conversion loses integer precision: 'unsigned long' to 'CC_LONG' (aka 'unsigned int') 隐式转换失去整数精度:'unsigned long'到'int'-错误 - Implicit conversion loses integer precision: 'unsigned long' to 'int' - Error iOS 7.1 CommonCrypto库抱怨:隐式转换失去整数精度:'NSUInteger'(无符号长整型)到CC_LONG(unsigned int) - iOS 7.1 CommonCrypto library complains: Implicit conversion loses integer precision: 'NSUInteger' (unsigned long) to CC_LONG (unsigned int) Arc 不允许将“nsinteger”(又名“long”)隐式转换为“nsstring *” - Implicit Conversion of 'nsinteger' (aka 'long') to 'nsstring *' is Disallowed with Arc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM