'supportedInterfaceOrientations'的实现中返回类型冲突:-警告 [英] Conflicting return type in implementation of 'supportedInterfaceOrientations': - Warning
问题描述
升级到Xcode 7.0后,我在UIViewControllerRotation方法中收到一条警告:- (NSUInteger)supportedInterfaceOrientations
:
After upgrading to Xcode 7.0 I get a warning in the UIViewControllerRotation method: - (NSUInteger)supportedInterfaceOrientations
:
实现中冲突的返回类型 'supportedInterfaceOrientations':'UIInterfaceOrientationMask'(aka 'enum UIInterfaceOrientationMask')vs'NSUInteger'(aka'unsigned int')
Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int')
那是为什么,我该如何解决?
Why is that, and how do I fix it?
如果转到定义,您将看到返回类型已正确更改:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0);
,但是更改代码中的返回类型不会使警告消失.
If you go to the definition you'll see that the return type acctually has changed:
- (UIInterfaceOrientationMask)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0);
but changing the return type in the code doesn't silence the warning.
推荐答案
尝试此调整:
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
- (NSUInteger)supportedInterfaceOrientations
#else
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
#endif
{
return UIInterfaceOrientationMaskPortrait;
}
这篇关于'supportedInterfaceOrientations'的实现中返回类型冲突:-警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!