How do you set the default device in the iPhone simulator?

会有一股神秘感。 提交于 2019-12-29 08:27:11

问题


Every time I switch Xcode between debugging on my iPhone and running in the simulator it resets the simulated device. I want to run the simulator as an iPhone device, but it keeps changing back to iPad. Does anyone know how to set the configuration so that the simulator defaults to an iPhone device?

I can switch the hardware to iPhone inside the Simulator, but when I go back to Xcode and run a "Build Debug" it reopens the app inside an iPad. The only way I can get it to switch is by using the Overview menu in Xcode, the choices I see are iPad Simulator 3.2 and iPhone Simulator 4.0

And when I switch between device and simulator then it always goes back to iPad.


回答1:


What is the Base SDK set to in your project (General tab)? If it's not 4.0 then I think it may assume you are writing an iPad app.

If you set it to 3.2 wanting to support iOS 3.x, you need to set the base SDK to 4.0, then go into project build settings tab and change the OS Deployment target to 3.1 (or whatever the earliest version is you want to support).




回答2:


I got XCode 4 to launch the iPhone simulator instead of the iPad simulator by doing this:

  1. In the "Product" menu, pick "Edit Scheme".
  2. Single-Click "Run *Your_Project_Name* Debug" from the list on the left of the scheme editing window.
  3. At the top of the window notice that the pull-down above "Destination" is set to "iPad 4.3 Simulator".
  4. Change the pull-down to "iPhone 4.3 Simulator".
  5. Click "OK".



回答3:


In Xcode 9 you can select multiple devices. However an easy way to default to your favorite device is the following:

  1. Choose your device from simulator-hardware-device-os you are working on
  2. Now go to simulators - windows and turn off “ show device bezel”
  3. Now simply close the ones you don’t want



回答4:


In the iPhone Simulator, go to Hardware>Device, and select "iPhone". Whatever you choose there is automatically saved.




回答5:


had the same problem - that is how i found this thread.

in SDK 4.2 make sure that when you open the a new xcode project you choose Product = 'iPhone' - the default selection is Ipad. Then when you save the project the device settings are saved with it.



来源:https://stackoverflow.com/questions/3384650/how-do-you-set-the-default-device-in-the-iphone-simulator

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