ios - 'supportedInterfaceOrientations' : - Warning 实现中的返回类型冲突

标签 ios objective-c xcode

升级到 Xcode 7.0 后,我在 UIViewControllerRotation 方法中收到警告:- (NSUInteger)supportedInterfaceOrientations:

Conflicting return type in implementation of 'supportedInterfaceOrientations': 'UIInterfaceOrientationMask' (aka 'enum UIInterfaceOrientationMask') vs 'NSUInteger' (aka 'unsigned int')

为什么会这样,我该如何解决?

编辑: 如果你去定义你会看到返回类型实际上已经改变了: - (UIInterfaceOrientationMask)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0); 但更改代码中的返回类型不会使警告静音。

最佳答案

试试这个调整:

#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000  
- (NSUInteger)supportedInterfaceOrientations  
#else  
- (UIInterfaceOrientationMask)supportedInterfaceOrientations  
#endif  
{
   return UIInterfaceOrientationMaskPortrait;
}

关于ios - 'supportedInterfaceOrientations' : - Warning 实现中的返回类型冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32699286/

相关文章:

ios - iOS10 中的动画导航栏 barTintColor 更改不起作用

ios - 为什么在 Swift 中创建默认值数组时不需要 <Element> ?

ios - 调用将隐藏另一个类的按钮的函数 - swift

objective-c - 使用滑动手势删除表格 View 上的行

swift - 由于信号段错误 11,Xcode 8 随机命令失败

ios - 如何在不使用查询的情况下在 Parse 上发送图像?

ios - 在不调用 reloadData 的情况下更新 tableView 中的特定单元格

ios - AFNetworking 发出请求时遇到问题

ios - 如何使用 objective-c 停止和启动应用程序委托(delegate)计时器?

ios - XCode: UNIX [Permission denied] 尝试下载开发证书时