Liam Shalon
Liam Shalon

Reputation: 442

remoteControlReceivedWithEvent in Swift has superclass error

I'm trying to implement a remoteControlWithEvent (in Swift, iOS 9), but I get an error in my App Delegate.

I've got this code below in my viewController, and everything is working flawlessly.

try AVAudioSession.sharedInstance().setActive(true)
                print("AVAudioSession is Active")
                UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
                self.becomeFirstResponder()

However, in my AppDelegate, if I try to use the function remoteControlWithEvent,

override func remoteControlReceivedWithEvent(event: UIEvent) {
        let rc = event.subtype
        print("does this work? \(rc.rawValue)")
    }

I get the error, "Method does not override any method from it's superclass". If I try to take out the override, I get another error...

Let me know if you can help!

-Liam

Upvotes: 0

Views: 1864

Answers (1)

beyowulf
beyowulf

Reputation: 15331

Actually try this:

override func remoteControlReceivedWithEvent(event: UIEvent?) {
        let rc = event!.subtype
        print("does this work? \(rc.rawValue)")
    }

Upvotes: 3

Related Questions