CarPlay停车应用程序在从Xcode 12.5.1 CarPlay模拟器启动时崩溃



我是iOS开发的新手。有任务要用CarPlay扩展我们的iOS应用程序。我创建了类"CarPlaySceneDelegate"作为Car Play的入口点。代码如下:

class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
var interfaceController: CPInterfaceController?

func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene,
didConnect interfaceController: CPInterfaceController) {
self.interfaceController = interfaceController
...
interfaceController.setRootTemplate(tabBarTemplate, animated: true)

}        
private func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene,
didDisconnect interfaceController: CPInterfaceController) {
self.interfaceController = nil
}
}

在Info.plist中,我添加了以下配置:

<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>Configuration Name</key>
<string>Default configuration</string>
<key>Delegate Class Name</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>Storyboard Name</key>
<string>Main</string>
</dict>
</array>
<key>CPTemplateApplicationSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>CPTemplateApplicationScene</string>
<key>UISceneConfigurationName</key>
<string>BlueGate-Car</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).CarPlaySceneDelegate</string>
</dict>
</array>
</dict>
</dict>

在模拟器上启动时,CarPlay根据CarPlaySceneDelegate类启动良好。但在iPhone模拟器上,它根本没有推出。应用程序加载,屏幕变黑。

控制台中:

2021-11-03 12:45:11.228204+0200 BlueGate[5806:119147]  - <AppMeasurement>[I-ACS036001] Analytics screen reporting is disabled. UIViewController transitions will not be logged.
2021-11-03 10:45:11 +0000 [AppDelegate.swift]:[application(_:didFinishLaunchingWithOptions:)][103:19] start function
2021-11-03 12:45:11.714422+0200 BlueGate[5806:118883] [Firebase/Crashlytics] Version 8.7.0
2021-11-03 12:45:12.108628+0200 BlueGate[5806:119153] 8.7.0 - [Firebase/Analytics][I-ACS023007] Analytics v.8.7.0 started
2021-11-03 12:45:12.119347+0200 BlueGate[5806:119153] 8.7.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://<someLink>)
2021-11-03 12:45:12.140585+0200 BlueGate[5806:119154] 8.7.0 - [Firebase/Analytics][I-ACS025036] App Delegate Proxy is disabled
2021-11-03 10:45:12 +0000 [AppDelegate.swift]:[configureNetworkMonitoring()][89:35] Network is ON
2021-11-03 12:45:12.316632+0200 BlueGate[5806:119154] 8.7.0 - [Firebase/Messaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '188981723956'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set.
2021-11-03 12:45:17.626397+0200 BlueGate[5806:119147] 8.7.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2021-11-03 12:45:17.735262+0200 BlueGate[5806:119147] 8.7.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled

我的环境Xcode 12.5.1

我做错了什么吗?或者我有没有其他方法可以通过Xcode/swift实现CarPlay部件功能,同时将移动应用程序保持在iOS上?

感谢任何意见或帮助。

plist中应用程序场景的键似乎是错误的。尝试使用UISceneConfigurationName代替Configuration Name,使用UISceneDelegateClassName代替Delegate Class Name,并使用UILaunchStoryboardName代替Storyboard Name

最新更新