How to change the default Xcode iphone simulator when testing

前端 未结 14 1716
耶瑟儿~
耶瑟儿~ 2020-12-18 18:30

I don\'t know why but now the default iphone simulator launched when I build the project is \"ipad\", but I want it to use iphone 3g instead.

Any way to set this pre

相关标签:
14条回答
  • 2020-12-18 19:24

    You can select the device from the menu inthe simulator.

    0 讨论(0)
  • 2020-12-18 19:25

    For me works changing active SDK from 3.2 to 4.0. If your project is mentioned to work on iPad and iPhone (or for compatibility matters) I believe the only way is manually switching active executable before running your app on simulator. Apple:"iPhone OS 3.2 does not support iPhone and iPod touch devices. It runs only on iPad.".

    0 讨论(0)
  • 2020-12-18 19:27

    If you are using Flutter, open the Runner.xcodeproj file in ios/ folder. Then right next to the Runner breadcrumb, you can click >and select what device to launch.

    0 讨论(0)
  • 2020-12-18 19:29

    Yes, it's annoying. This worked for me: Open the .plist file in group/folder resources and check the checkbox for key "Application requires iPhone environment".

    0 讨论(0)
  • 2020-12-18 19:32

    None of the above worked for me, but the following took care of the issue :

    Source: http://www.cocoabuilder.com/archive/xcode/301182-xcode-3-2-6-keeps-switching-to-ipad-simulator.html

    Excerpt:

    This works for XCode 3.2.6. I don't yet use XCode 4.x so don't know if this will work for it or not. I would also quit XCode before doing this, just in case.

    Go to the project folder and find the .xcodeproj file. Right-click (or Control-click) it and select Show Package Contents. When the package contents window appears, find the .pbxuser file (there might be multiple such files if the project was worked on by multiple folks and/or multiple computers). Open this file, which is XML, in your preferred text editor. Find the section with the comment "/* Project object */". There is most likely not a line in that section for the key "activeSDKPreference". If there is no such key, add the following:

    activeSDKPreference = iphonesimulator4.2;

    I found it after the "activeExecutable" key in that section, so I've been adding it in that same order.

    If there is already an "activeSDKPreference" entry, change it to "iphonesimulator4.2".

    Close the editor and the package contents window and then double click the .xcodeproj file to reopen the project. Now you should have entries for iPhone Simulator 4.2 and iPad Simulator 4.2 in the project settings pull down menu, with iPhone Simulator 4.2 probably already checked.

    Additional Notes:

    1) In my particular case, my entry in .pbxuser file had said iphonesimulator4.3, even though under Project-Project Settings menu it said iphonesimulaor4.2!. However, once I changed it to iphonesimulator4.2 in the .pbxuser file it stop auto selecting iPad all the time.

    2) If you use SVN you will not see an "M" in SVN column showing that you changed the project (even if you refresh/update). However, just do a "Commit Entire Project" and your changes to .pbxuser file will get updated. I also suggest referencing this post in your check-in comment in case you ever need to change it back for whatever reason.

    0 讨论(0)
  • 2020-12-18 19:35

    I'm also looking for a way to have "iPhone" always auto selected instead of iPad. We all know we can select from the simulator. Since 4.2, it's even more problematic.

    0 讨论(0)
提交回复
热议问题