有没有办法在应用程序中检测手机是否使用 Carplay 与汽车连接/断开连接?似乎找不到任何有关它的文档。我正在考虑一些我可以监控的系统事件。
问问题
1931 次
1 回答
1
您是否遵循了这些步骤?
- 将相应的记录添加到项目的权利文件中:
com.apple.developer.carplay-maps
类型为Boolean
带值YES
- 请求苹果相应的权限
- 让您的 AppDelegate 确认
CPApplicationDelegate
协议 实现下一个方法:
/** The CarPlay screen has connected and is ready to present content. Your app should create its view controller and assign it to the @c rootViewController property of this window. @note It is the responsibility of the delegate to maintain a reference to the interface controller beyond the scope of this method. */ - (void)application:(UIApplication *)application didConnectCarInterfaceController:(CPInterfaceController *)interfaceController toWindow:(CPWindow *)window; /** The CarPlay screen has disconnected. */ - (void)application:(UIApplication *)application didDisconnectCarInterfaceController:(CPInterfaceController *)interfaceController fromWindow:(CPWindow *)window;
于 2018-11-06T13:03:24.157 回答