Switch between CarPlay and regular window in iOS simulator

早过忘川 提交于 2019-12-21 23:34:03

问题


I am testing an app that has some CarPlay functionalities. I activated the CarPlay window in the simulator by changing the default options using

defaults write com.apple.iphonesimulator CarPlay -bool YES

which works perfectly when it comes to starting up the CarPlay windows, either when the simulator starts automatically after the application is compiled in debug or if I manually open up the CarPlay window through Hardware -> External Displays -> CarPlay when the app is already running in the simulator. The problem is that, in both cases, the main simulator window goes dark (after showing the CarPlay splashscreen simmilar to the one seen on the phone in this image).

Now, I don't exactly know what the real life behavior is supposed to be, but I can't manage to simply execute a "shut-down" behavior on the CarPlay window and switch back to the main simulator window so that it displays the app (or anything else for that matter). Currently, if I got back to the simulator menu and select Hardware -> External Displays -> None, the CarPlay window simply dissapears, but the main simulator window stay blacked out.

So, my question is, how can one simulate a CarPlay "shutdown" behavior when using the simulator, and how can I get back the OS in the main simulator window ? On a more development focused side, I would also like to know exactly if and how I can detect that the Media Player becomes "turned off" when CarPlay shuts down, or, more specifically, if there is a way that one can programatically observe the event where the CarPlay's media control capabilities become "unavailable".


回答1:


I can only partially answer your question. To bring back the app itself or the OS main window, simply press (or simulate a press Shift+Cmd+H) of the home button.




回答2:


CarPlay "shutdown" behavior? No such thing.

If a user disconnects from the car - the UI is gone.

If you want to kill the app why in a CarPlay session - simply bring the iPhone simulator back into focus and unlock it (by tapping the Home button = Cmd+Shift+H). Then the iPhone should work. You should see the app close.



来源:https://stackoverflow.com/questions/32723237/switch-between-carplay-and-regular-window-in-ios-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!