Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Error Swift Method不会覆盖其中的任何方法';超级级_Ios_Swift_Error Handling_Superclass - Fatal编程技术网

Ios Error Swift Method不会覆盖其中的任何方法';超级级

Ios Error Swift Method不会覆盖其中的任何方法';超级级,ios,swift,error-handling,superclass,Ios,Swift,Error Handling,Superclass,因此,我正在编写一个教程,我已经完成了它,当我更新到xcode 7时,我所有的代码都被bug弄得乱七八糟 在上面的文章中,我得到了一个错误“method不重写其超类中的任何方法”,但当我删除重写时,我得到了这个错误:带有Objective-C选择器的方法'SupportedInterfaceOrientions()'与方法'SupportedInterfaceOrientions()冲突'来自具有相同Objective-C选择器的超类'UIViewController' 我一直在研究,但我对编程

因此,我正在编写一个教程,我已经完成了它,当我更新到xcode 7时,我所有的代码都被bug弄得乱七八糟

在上面的文章中,我得到了一个错误“method不重写其超类中的任何方法”,但当我删除重写时,我得到了这个错误:带有Objective-C选择器的方法'SupportedInterfaceOrientions()'与方法'SupportedInterfaceOrientions()冲突'来自具有相同Objective-C选择器的超类'UIViewController'

我一直在研究,但我对编程很陌生,这里的很多答案我都不太了解,不适合我的情况


谢谢

它不再返回
Int
。新方法签名需要返回
UIInterfaceOrientationTask

override func supportedInterfaceOrientations() -> Int {
    if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
        return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
    } else {
        return Int(UIInterfaceOrientationMask.All.rawValue)
    }
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    if UIDevice.currentDevice().userInterfaceIdiom == .phone {
        return UIInterfaceOrientationMask.allButUpsideDown
    } else {
        return UIInterfaceOrientationMask.all
    }
}