D
D
Denis2019-06-22 08:33:52
Swift
Denis, 2019-06-22 08:33:52

How to fix Declaration 'pressesEnded(presses:withEvent:)' has different argument labels from any potential overrides error?

I found an application for tvOS, written in swift 2, when I tried to launch it on version 4, a bunch of errors appeared, I fixed almost everything, somewhere with the help of Fix, somewhere by googling, but there are two errors left that cannot be googled and XCode does not offer to fix them.
Declaration 'pressesEnded(presses:withEvent:)' has different argument labels from any potential
overrides

override func pressesEnded(presses: Set<UIPress>, withEvent event: UIPressesEvent?) {
        if presses.first?.type == UIPressType.menu {
            if let _ = (self.view as? SKView)?.scene as? MenuScene {
                // default behaviour [exit to apple tv home]
                super.pressesEnded(presses, with: event)
            }
        } else {
            // default behaviour [exit to apple tv home]
            super.pressesEnded(presses, with: event)
        }
    }
    
    override func pressesBegan(presses: Set<UIPress>, withEvent event: UIPressesEvent?) {
        if presses.first?.type == UIPressType.menu {
            if let _ = (self.view as? SKView)?.scene as? MenuScene {
                // default behaviour [exit to apple tv home]
                super.pressesBegan(presses, with: event)
            } else if let scene = (self.view as? SKView)?.scene as? GameScene {
                scene.returnToMenu()
            }
        } else {
            // default behaviour [exit to apple tv home]
            super.pressesBegan(presses, with: event)
        }
    }

5d0dbdbe5011e007528149.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
doublench21, 2019-06-22
@foma24

Well, after all, even Xcode itself writes to you:
For you, even Xcode has built-in documentation - ⌘ + Shift + 0. If you enter the name of this method and look at the arguments, it becomes clear what pressesneeds to be replaced _ presses, but withEventyou need to replace with withDo the same with the second method.
PS If you position yourself as an iOS developer, then how will you continue if such a simple mistake causes dissonance.

S
Sergey Burduzha, 2017-08-17
@serii81

I will use zsh, there are more options and less conflicts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question