Crash in CarPlay: [CPInterfaceController clientPushedIllegalTemplateOfClass:]

Hi,

we see some crashes in our app with the new CarPlay Framework resulting in this error message: SIGABRT: Application pushed an illegal template of class CPGridTemplate.
Unfortunately the stacktraces don't include calls from our app.

The CPGridTemplate is valid for our app, as we have an audio app and it works in all cases we have tested so far.

Does anyone has an idea what causes this and how we can fix it?
You're correct that the grid template is available for audio apps. However, for audio apps, there are additional restrictions related to the Now Playing template - in particular, only the List template may be pushed on top of the Now Playing template. Is it possible you're trying to push a grid template when Now Playing is visible? More details are available in the CarPlay developer guide: https://developer.apple.com/carplay/documentation/CarPlay-App-Programming-Guide.pdf
I can't see any situation we are pushing anything on top of Now Playing. The GridTemplate we only use as one of two templates in a TabBarTemplate. To set the Template we use either CPTabBarTemplate(templates: []) or tabBarTemplate.updateTemplates([gridTemplate, listTemplate]).
Hm, the crash mentions the grid template being pushed but maybe it is because you try to set the template as the root template (instead of embedding it in a tab template)? Tab and list templates might be the only allowed root templates. Another problem might be that you exceed the number of allowed templates in the navigation stack (afaik 5 for audio apps), so it just happens to be a grid template that's pushed on a "full" stack.
Thanks for this idea @fruitcoder_DE, I wasn't aware of this limitation of the stack in CarPlay. But unfortunately we have no case where we push a GridTemplate directly. We have just one place where a GridTemplate is used, and this is as one root template in a Tab template.
I have taken a look at CarPlaySupport.framework with Hopper to check when this exception is thrown (calls to clientPushedIllegalTemplateOfClass). It is called from _templateIsValidForCurrentEntitlement which check whether the template is valid at all for the current entitlement (it is) and then there is this aforementioned check if the top view controller is a CPSNowPlayingViewController the template to be pushed has to be a CPListTemplate.
Can you check again, that there are no calls to pushTemplate containing anything but list templates?
Crash in CarPlay: [CPInterfaceController clientPushedIllegalTemplateOfClass:]
 
 
Q