xcodeios15carplay

carplay setRootTemplate crash (Allowed classes: (null))


I'm middle of transition from old carplay to new ios15 carplay.

I asked carplay entitlement to apple and have it now.

so I put some sample codes and run.

the code is

func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) {
    CPLogger.log("in templateApplicationScene didConnect")
    self.interfaceController = interfaceController
    let screen = CPListTemplate(title: "CarPlay", sections: [])
    self.interfaceController!.setRootTemplate(screen, animated: true, completion: { _,_ in
        })
    }

this method was hit so I think I dit it right from Application Scene Manifest of info.plist.

after that I faced crash and it said (last part is important in this case.)

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported object <CPListTemplate: 0x600001c79b80> <identifier: 8105D933-642B-4111-80D7-C910466237F5, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to setRootTemplate:animated:completion:. Allowed classes: (null)'

most search result has messages like Thread 1: "Unsupported object <CPInformationTemplate: 0x6000012de010> <identifier: 3444D3F1-ECFF-4953-B543-459286E11371, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to setRootTemplate:animated:completion:. Allowed classes: {(\n CPTabBarTemplate,\n CPListTemplate,\n CPGridTemplate,\n CPAlertTemplate,\n CPVoiceControlTemplate,\n CPNowPlayingTemplate\n)}".

Allowed classes part has some information. But not mine.

I added proper info to an entitlements info enter image description here

and I have a provisioning that includes carplay-audio option. enter image description here

I have only one result that has 'Allowed classes: (null)' string which is https://githubmemory.com/@oguzhnatly

He said "Such a thing Allowed classes: (null) is almost impossible to happen. Normally, it must contain the name of CarPlay Templates."

and I don't have something useful.

now I'm completely lost...

HELP ME!

thanks


Solution

  • I started getting this after switching to a M1 MBP. Does not matter which type of template I try to set as root template. Still works on my old Intel Mac so it seems to be a M1 bug.

    EDIT: I FIXED IT!

    After skulking around the Apple Dev Forums I found someone with the same problem, but the problem only appeared after adding arm64 to Excluded Architectures.

    Excluded Archs

    I too had added this to get the Google Places SDK to compile, so removing it was tricky. But Google has released a beta version of the SDK that is compatible with M1, but it needs to be installed manually or via Carthage. I removed the old SDK, removed arm64 from EXCLUDED_ARCHS, installed the beta SDK and it worked! Now I can use the CarPlay Simulator on M1 without errors. Hopefully this helps!