5

有没有办法在应用程序中检测手机是否使用 Carplay 与汽车连接/断开连接?似乎找不到任何有关它的文档。我正在考虑一些我可以监控的系统事件。

4

1 回答 1

1

您是否遵循了这些步骤?

  1. 将相应的记录添加到项目的权利文件中:com.apple.developer.carplay-maps类型为Boolean带值YES
  2. 请求苹果相应的权限
  3. 让您的 AppDelegate 确认CPApplicationDelegate协议
  4. 实现下一个方法:

    /**
     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;
    

请检查此文档链接此 WWDC 2018 Carplay 会议

于 2018-11-06T13:03:24.157 回答