How to change the default Xcode iphone simulator when testing - iphone

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 preference?

On Mac, if you right click on the Simulator icon, you can select devices and it will open a new device.
Or go to File -> Open Simulator

In Xcode,
Click Product -> Destination -> iOS Simulator -> Choose Device to run.
Then build and execute Xcode project.
It works..

2022 Fix:
You have two options!
With the simulator running go to File > Open Simulator > iOS [current version] and select the desired device.
With the simulator running, right click the icon in the bottom toolbar, select Device > iOS [current version] and select the desired device
If you are using Expo, after selecting the new device will open in a new window, so you'll have both. Heres how to get Expo to run on the new device:
Close the device window you don't want (cmd + w)
You will now be able to "Run on iOS Simulator" and it will open up Expo Go on the new device.
2020 Fix:
With the simulator running go to File > Open Device > iOS > iPhone 11 and select the device. It will open up the device as another window but there won't be the Expo app.
Close the device window you don't want (cmd + w), then close the window with the device you would like.
Restart Expo (in the command window with it running do ctrl + c then re-run Expo with expo start
You will now be able to "Run on iOS Simulator" and it will open up with the selected device type.

In the chance that anyone reading this is building their app in react-native, the solution is the --simulator option.
For example:
$ react-native run-ios --simulator "iPhone X"

Go to Hardware > Device from simulator menu.

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.".

You can select the device from the menu inthe simulator.

Try
Project > Active Executable , and select the one you want the most.

This worked for me. When I already have the app open on an iphone in "Simulator". I click File -> Open Simulator -> iOS 14.0 -> iPhone 8 (or iPad (7th generation))

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:
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.
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.

I finally solved this problem myself.
First, install new version of Xcode, which is Xcode 4.
Then set project scheme to iPhone Simulator and run app in Xcode several times.
And re-install Xcode 3 and the problem will be gone!

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".

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.

For Xcode Version 3.2.6 the following helps:
Project->Active Executable->iPhone Simulator 4.3
I don't know if it is working for newer Xcode environments.
Gary Tsui has also pointed out this approach previously.

Related

iOS simulator is not lisiting in visual studio 2019

enter image description here
iOS-simulator is not listed all the time. sometime its showing most of the time its not there. not doing any specific changes in my machine. Simply when i restart VS app. its missing.
tried unload & reload the ios project. still the same.
complete reinstall visual studio & xcode from scratch.
tried update xcode.
Nothing helped from above suggestions.
Would be really great help if someone could help me with this issue.
I've encountered the same problem several times and here are some of my suggestions:
Did you try switching to your Android project then switch back to iOS project? This should be the simplest way
In your iOS project options, create a build configuration specifically dedicated to iOS Simulators only. Make sure to set Linker behavior to Don't Link
Quit Xcode and Visual Studio first. Open Finder, press Command + Shift + G, paste the following path: Users/YourUserNameHere/Library/Developer/Devices/ You'll see a bunch of folders with encoded folder names and a file device_set.plist
Next delete all the folders in Devices directory, then open device_set.plist by double clicking it. This should open it in Xcode. You'll see a bunch of key-value pairs under DefaultDevices and DevicePairs, click on the arrow on the left side and delete of the devices listed there by hovering the mouse over a category and click the minus (-) button next to it.
Press Command + Shift + 2 to open Devices & Simulators Window (Alternatively you can choose on menu Window -> Devices and Simulators. Choose Simulators on the left sidebar. Delete all the simulators if there's still any of them showing up. Then create several simulators, ones that you really need for debugging your app. Quit Xcode, reboot the machine, open Visual Studio again.

Xcode 4.6 builds, runs and finishes instantly (simulator iOS 6.1)

In xcode, I tried to add a tap gesture to my app and when I built it, it started a problem with Xcode. It goes from building, 'running on iPhone 6.1 simulator' to 'finished running on iPhone 6.1 simulator'.
If the simulator is closed, it starts up with a black screen and you cannot click the home button etc. If open, nothing happens, the app doesn't install but the simulator doesn't crash.
I have tried the armv6 architecture 'fix' but that didn't work. I have also cleaned the project and project data. I have reset the simulator multiple times as well.
If I add the old files to my new project, it works up to a point (I copy and paste old files into new) but then the same happens.
Thanks for your help in advance!
NOTE:
New blank projects build and run fine.
EDIT: It still didn't work after undoing my previous actions, and the simulator is responding according to Finder, although the screen stays black
–––––––––––––––––––––––––––––––––––––––––
UPDATE
I had a folder named 'resources' in my application, imported as a reference which, following links from the thread #arthan.v supplied me with fixed the problem. What I did was rename the folder to files and reimport it.
Thank you so much, I spent 2 days trying to fix it before now!
Click the Center Button in View on your right hand side of Xcode.
In your Bottom bar, you'll see error: failed to attach to process ID 0.
Check these error: failed to attach to process ID 0 and Xcode compiles my App, but can't run it in the simulator
This sometimes gets fixed by these steps:
iOS Simulator > Reset Content and Settings ... > Reset
Xcode > Build and Run
I experienced the same issue after I had re-organized some code and renamed the workspace and project. Eventually realized there was an old version of my test app on the simulator's homescreen. I delete that and then everything was building fine again.
You might need to add the device to the provisioning profile. I experienced this on Xcode 6 and a real device.

How to change a project created for iPhone to ipad (Universal)?

I was started my application for targeting iPhone, now I want to use my app for iPad also. As I started as iPhone project, even though I add the iPad xib, it is not showing properly, How to convert my project which will work for both iPhone and iPad(Universal). Any way to change in project setting?
Click on targets -> Summary ,then change the devices to universal.
Open the project in Xcode. Under the Targets menu ,right click on your app. Select "Upgrade current target for iPad.
Another more user interactive way is
Click on your project-> Click on targets->iOS application target->Device->Universal.

XCode Locks Up When Launching the iOS Simulator

Lately when I have been deploying any iOS application to the simulator (iPad or iPhone), XCode locks up (Not Responding) and the simulator simply displays a black screen. I have to force quit both.
Steps I have taken so far towards a resolution:
Clean
Reset the Simulator
Deleted the simulator folder
Reinstalled XCode from the App Store
Reinstalled XCode from the developer center
Has anyone else encountered this? Any suggestions for a solution?
Other info:
OSX Lion 10.7.3
XCode 4.3.2
Shibboleet
Thanks in advance for any help.
I had this problem and was able to continue by:
1) Edit the run scheme by clicking on the first part of the App name to the right of the "Stop" button to bring down the scheme list and click "Edit Scheme..."
2) Click on the Run item and change the debugger from LLDB to GDB.
3) Run
I think the problem was that I validated the settings and it offered to automatically change the debugger from GDB and LLDB and I clicked "OK" because the advisor message sounded very self-assured.
Enjoy.
Under Scheme, go to edit scheme, and change launch from wait for App.app to launch to automatically under the Info tab.
EDIT: If you upgraded Xcode, make sure the old separate simulator is uninstalled.
hmmm, weird simulator, instruments issue i had once would work when i command-tabbed back and forth. try deleting derived data?

How to change iPhone/iPad app to iPhone only?

I've been a bit stupid and built my app as being targeted for both iPhone and iPad, whereas it should really just be for the iPhone.
How do I change the settings so that the build is only for the iPhone? I've actually finished coding the app and ready to submit it, so hopefully it's just a case of changing some obscure project settings (as opposed to creating a new project and coping all the code over).
Thanks St.Ov.!
You have to change the Targeted device family. Select the project, then info-->Deployment--->Targeted device family to iPhone only and you have to do the same thing in targets. After that your app will be only for iPhone.
Good Luck!
U can do this by going through the following steps.
Select Edit Project settings from Projects .
Go to build settings.
Select Targeted Device Family and Choose iPhone.
That should do it.
Have fun.
For Xcode 5.1.1:
Select your project and then go to:
General->Deployment Info -> Devices
and then select just iPhone
In XCode 9.4.1
Project Navigator -> Select Project
General -> Deployment Info
Devices -> iPhone
Project -> Edit Project Settings -> Build -> Targeted Device Family = iPhone
Open "[project]-Info.plist" and change "Main nib file base name (iPad)" in "MainWindow_iPhone"
I hope this helps :-)
For Xcode 4.2:
Select the project navigator (little folder icon in the top left), then select your project (the top most item)
Move across to the next column, select the appropriate target
Move across to the next column, select the summary tab
Select iphone from the devices dropdown.