-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
I tried this to separate remoteControlEvents and my code looks like
import Foundation
import PluggableApplicationDelegate
final class MusicControlsAppService: NSObject, ApplicationService {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
UIApplication.shared.beginReceivingRemoteControlEvents()
print("It has started!")
return true
}
func applicationDidEnterBackground(_ application: UIApplication) {
print("It has entered background")
}
override func remoteControlReceived(with event: UIEvent?) {
if event?.type == .remoteControl {
switch event!.subtype {
case .remoteControlPlay:
PlayerManager.shared.playTapped()
case .remoteControlPause:
PlayerManager.shared.pauseTapped()
case .remoteControlTogglePlayPause:
if PlayerManager.shared.isPauseActive {
PlayerManager.shared.playTapped()
} else {
PlayerManager.shared.pauseTapped()
}
case .remoteControlNextTrack:
PlayerManager.shared.nextTapped()
case .remoteControlPreviousTrack:
PlayerManager.shared.previousTapped()
default:
break
}
}
}
}
This gives error for the method Method does not override any method from its superclass , also when override keyword is removed it doesn't get calls.
Can you assist to solve this ? As of now I am keeping that method in the main App delegate which is subclass of PluggableApplicationDelegate which works.
Metadata
Metadata
Assignees
Labels
No labels