[CarPlay] CPNowPlayingTemplate not being accepted when being passed to pushTemplate:animated:completion

Hey team,

I have an app in CarPlay where i was pushing the CPNowPlayingTemplate as follows:

self.interfaceController.pushTemplate(CPNowPlayingTemplate.shared(), animated: true) 

This used to work perfectly, but suddenly I have started to get this error

NSInvalidArgumentException: Unsupported object <CPNowPlayingTemplate: 0x119a0b5c0> <identifier: 6EE4E5A9-B1FB-4341-A485-78D7DDEBD8D0, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to pushTemplate:animated:completion:. Allowed classes: {(
    CPActionSheetTemplate,
    CPAlertTemplate,
    CPVoiceControlTemplate,
    CPTabBarTemplate,
    CPListTemplate,
    CPInformationTemplate,
    CPContactTemplate,
    CPMapTemplate,
    CPGridTemplate,
    CPSearchTemplate
)}

How is this possible? Even on Apple docs, it says to pushTemplate

Refer

Answered by imojito in 862399022

Looked at a previous embeddedcapabilities and the current one being generated and we see CarPlay Navigation App enabled. Since our app was no longer being considered as an audio app, we could not attach the CPNowPlayingScreenTemplate

force a rebuild now that capabilities have been updated to the ones we had

Note:

I have a max of 3 templates going on:

  • Home screen
  • Album screen with all songs
  • NPS now playing screen

I have the following entitlement also:

com.apple.developer.carplay-audio

Note: The issue is not reproducible on local xCode but when i deployed to appStore it started showing this exception.

Accepted Answer

Looked at a previous embeddedcapabilities and the current one being generated and we see CarPlay Navigation App enabled. Since our app was no longer being considered as an audio app, we could not attach the CPNowPlayingScreenTemplate

force a rebuild now that capabilities have been updated to the ones we had

[CarPlay] CPNowPlayingTemplate not being accepted when being passed to pushTemplate:animated:completion
 
 
Q