简体   繁体   English

我可以将(unsigned)更改为(NSUInteger)还是会产生问题?

[英]Can I change (unsigned) to (NSUInteger) or will it create problems?

I am a Jr Software Developer, can I just change the (unsigned) to (NSUInteger) or will to create problems later? 我是一名Jr软件开发人员,可以将(unsigned)更改为(NSUInteger),还是以后再创建问题?

- (unsigned)retainCount
{
    return UINT_MAX;  //denotes an object that cannot be released
}

warning said 警告说

MKStoreManager.m:88:1: Conflicting return type in implementation of 'retainCount': 'NSUInteger' (aka 'unsigned long') vs 'unsigned int'

I found a previous definition 我找到了先前的定义

- (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;

Your method must return NSUInteger because that is how the retainCount method is defined in NSObject . 您的方法必须返回NSUInteger因为那是在NSObject定义retainCount方法的方式。

The error is being caused by the value you are trying to return. 该错误是由您试图返回的值引起的。 Instead of returning UINT_MAX , you should return NSUIntegerMax . 而不是返回UINT_MAX ,您应该返回NSUIntegerMax

The underlying type for NSUInteger changes depending on whether building for 32 or 64 bit. NSUInteger的基础类型根据构建32位还是64位而变化。 Accordingly, the value of NSUIntegerMax also changes to match the type. 因此, NSUIntegerMax的值也将更改以匹配类型。

- (NSUInteger)retainCount
{
    return NSUIntegerMax;  //denotes an object that cannot be released
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我似乎无法将NSUInteger除以2 - I can't seem to divide NSUInteger by 2 如何减去两个NSUInteger变量? - How can I subtract two NSUInteger variables? ARC是否不允许将“ NSUInteger”(又名“ unsigned long”)隐式转换为“ id”? - Implicit conversion of 'NSUInteger' (aka 'unsigned long') to 'id' is disallowed with ARC? 不兼容的操作数类型(“ NSUInteger”(又名“ unsigned long”)和“ id _Nullable”) - Incompatible operand types ('NSUInteger' (aka 'unsigned long') and 'id _Nullable') 我应该将NSNotFound与NSInteger或NSUInteger进行比较吗? - Should I compare NSNotFound to NSInteger or NSUInteger? iOS Build错误“使用不同类型('NSUInteger'(又名'unsigned long')对'ennum MTLPixelFormat')进行不同类型的Typedef重新定义” - iOS Build Error “Typedef redefinition with different types ('NSUInteger' (aka 'unsigned long') vs 'enum MTLPixelFormat')” 隐式转换在制作应用程序时将整数精度'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? 不兼容的整数转换指针将“NSIndexPath *__strong”发送到“NSUInteger”类型的参数(又名“unsigned long”) - Incompatible pointer to integer conversion sending 'NSIndexPath *__strong' to parameter of type 'NSUInteger' (aka 'unsigned long') 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)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM