Error: Symbol not found: _OBJC_CLASS_$_CPNowPlayingShuffleButton

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...

Accepted Reply

nevermind :) solved!

https://stackoverflow.com/questions/69654246/carplay-app-using-carplay-framework-crashes-on-ios-13-or-older-version

forgot to make CarPlay.framework as optional in build phase settings....

Replies

nevermind :) solved!

https://stackoverflow.com/questions/69654246/carplay-app-using-carplay-framework-crashes-on-ios-13-or-older-version

forgot to make CarPlay.framework as optional in build phase settings....