有没有一种方法可以在应用程序中检测手机是否使用Carplay与汽车连接/断开连接? 似乎找不到有关它的任何文档。 我在考虑可以监视的一些系统事件。
答案 0 :(得分:1)
您是否遵循了这些步骤?
com.apple.developer.carplay-maps
类型的Boolean
,其值为YES
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;