本文介绍了'supportedInterfaceOrientations'的实现中返回类型冲突:-警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
升级到Xcode 7.0后,我在UIViewControllerRotation方法中收到一条警告:- (NSUInteger)supportedInterfaceOrientations
:
After upgrading to Xcode 7.0 I get a warning in the UIViewControllerRotation method: - (NSUInteger)supportedInterfaceOrientations
:
那是为什么,我该如何解决?
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'的实现中返回类型冲突:-警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!