Hi Everybody,
I have a strange problem, I'm using UISceneDelegate with my app as well as CarPlay, in my CarPlay Scene delegate
@available(iOS 14.0, *) class PWRCarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
i have @available(iOS 14.0, *) check in my code, but when i try to run in ios 12.4 simulator it gives this error;
Error: Symbol not found: OBJC_CLASS$_CPNowPlayingShuffleButton
the class shouldnt be available in ios12, how can i solve this problem?
i wrap my code as;
func addNowPlayingTemplateButtons() { if #available(iOS 14.0, *) { let shuffleButton = CPNowPlayingShuffleButton() {_ in PowerMediaService.shared.changeShuffleMode( MPRemoteCommandCenter.shared().changeShuffleModeCommand.currentShuffleType) } nowPlayingTemplate?.updateNowPlayingButtons([shuffleButton]) } }
but it gives a warning "nnecessary check for 'iOS'; enclosing scope ensures guard will always be true" since whole class is in @available(iOS 14.0, *) and it still crashes on ios12 device...
nevermind :) solved!
forgot to make CarPlay.framework as optional in build phase settings....