XCode 3.2.5, iOS 4.2 - Why does the iPad Simulator launch instead of the iPhone Simulator? - iphone

I have an app that is iPhone only (Targeted Device Family == iPhone), Base SDK 4.2, iOS Deployment Target 4.0.
Once in a while, but pretty often, the target switch to iPad Simulator. Is this a bug ? I shouldn't even have this option in the target selection dropdown...

In my eyes is the best way to work arround is to set up the Device in the Simulator under Devices. There you can also choose between iPhone with or without Retina Display.
Once Open, the Simulator-Device will stay.
cheers

To Thomas : I thinkg that you chosed 'iPhone only' on the wrong configuration of the target (ex : 'distribution' instead of 'debug'). If you choose 'iPhone' for the debug configuration, your app should never lanch in the iPad simulator.
To kkend0g187 : choose 'iPhone' for the "targeted device family" in the debug configuration of the target. Otherwise, you will come back to the wrong device not just when you run but when you clean the targets before running.

Related

Instruments always launches iPad Simulator for Universal Apps with Automation, how can I force it to use the iPhone Simulator?

I've created a universal binary using iOS 4.2 and Xcode 3.2.5. I'm trying to do some automation testing on the application and since the interfaces are slightly different between the iPad and iPhone versions, I have separate UIAutomation scripts. Unfortunately, no matter what I do, when I click the record button in Instruments, it always starts the application using the iPad simulator. How can I force Instruments to launch the iPhone simulator?
The universal app runs fine in the simulator for all 3 simulated devices (iPhone, iPhone (Retina), and iPad). I can govern the Active Executable via Xcode and "Build and Run/Debug" works fine, correctly using the simulator specified. When I launch Instruments I'm choosing iOS Simulator > All > Automation, then selecting my automation script for the iPhone and then setting the target as project-name/build/Debug-iphonesimulator/project-name.
Before running your automation from the command line create a build of your universal app that is iPhone only by passing the following to xcodebuild:
TARGETED_DEVICE_FAMILY=1
Then run your automation using instruments.
If you want to then test iPad, make another build without that build option and then instruments / simulator will default back to iPad
For reference check out the docs for TARGETED_DEVICE_FAMILY here:
http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html
No need to mess around with your app at all: Instruments allows you to select whether to use the iPhone or iPad simulator. Assuming you've already selected your app:
Click the Target selector (currently displaying your app name).
Click "Edit Active Target"
Near the bottom, click the "Options" drop down.
At the bottom of the list, you can select the "Simulator Configuration".
A very easy solution is to modify the Info.plist of your application before launching the automation (no need to rebuild the app). Use PlistBuddy to modify the UIDeviceFamily to be either for iPhone or iPad. For example:
plistbuddy="/usr/libexec/PlistBuddy"
plistfile="$myapp/Info.plist"
if [ $device == "iphone" ]; then
uidevicefamily=1
else
uidevicefamily=2
fi
$plistbuddy -c "Delete :UIDeviceFamily" $plistfile
$plistbuddy -c "Add :UIDeviceFamily array" $plistfile
$plistbuddy -c "Add :UIDeviceFamily:0 integer $uidevicefamily" $plistfile
I was having problems with this as well, which I noticed because no matter which run settings I was using, XCode was displaying Simulator - 3.2, when it should have shown 4.0 or 4.1 for the SDK version on the iPhone simulator.
I was able to fix it by changing the "Target Device Family" setting over to iPhone/iPad, as it somehow was set to just iPad.

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

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.
I got XCode 4 to launch the iPhone simulator instead of the iPad simulator by doing this:
In the "Product" menu, pick "Edit Scheme".
Single-Click "Run *Your_Project_Name* Debug" from the list on the left of the scheme editing window.
At the top of the window notice that the pull-down above "Destination" is set to "iPad 4.3 Simulator".
Change the pull-down to "iPhone 4.3 Simulator".
Click "OK".
In Xcode 9 you can select multiple devices. However an easy way to default to your favorite device is the following:
Choose your device from simulator-hardware-device-os you are working on
Now go to simulators - windows and turn off “ show device bezel”
Now simply close the ones you don’t want
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).
In the iPhone Simulator, go to Hardware>Device, and select "iPhone". Whatever you choose there is automatically saved.
in iOS simulator go to :
File / Open Device / iOS 'versión' in my case (iOS 13.7) / Select the one you need
next time you open the simulator will be open with the device selected.
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.

Device Requirements - iphone ipodtouch -- NOT ipad?

Is there a way to specify that the app runs on the iphone, the ipod touch, and NOT the ipad? e.g. modify the info.plist somehow?
Edit your project settings, find the key "Targeted Device Family" and chose iPhone. Other choices are iPad and iPhone/iPad.
Don't forget to set this option in every configurations: debug, release and distribution...

Setting Xcode's target to iPhone NOT iPad

I just upgraded to iPhone SDK 3.2 Beta 4. Since doing so, I have not been able to get the app to launch in the iPhone simulator - it keeps launching in the iPad simulator. I have tried option-clicking the drop-down menu in the top left-corner of Xcode and setting 'Active Executable' to iPhone simulator 3.1.3 but it keeps going back to iPad simulator instead.
What gives? I have no interest in my app running on the iPad and I don't want to test it in the 2X mode in the simulator.
Thanks,
You can't really launch an iPhone app in 3.2.x - sometimes it will pop up - but basically right now it is only for iPad development.
Update for release version of Simulator.
First of all, the title of this question doesn't match the description: Xcode target isn't the same as the simulator hardware device.
If you are writing an app targeting 3.2, it can run on both iPad (using OS 3.2) and lower OS versions on the iPhone. You do this by setting the Base SDK to iPhone Device 3.2, the Targeted Device Family to iPhone/iPad, and the iPhone OS Deployment Target to 3.1 (lower than 3.2).
The iPhone simulator has a menu option for Hardware->Device, which can be set to iPhone or iPad. However, you can only run a 3.2 SDK target in iPad mode, and a Universal app that supports iPad can only use the 3.2 SDK to build.
You can of course set the simulator to iPhone mode and launch your app from Springboard, but that will lose the debugger connection. Switching mode during installation of your app will cause it to crash.
So the short answer is still the same: you can't run a Universal iPad app in the iPhone mode simulator while debugging.
Upper-left corner of the IDE find a dropdown list of Simulator versions - flipped to 3.2 - try to put it back to 3.1.3
and relaunch your app.
This was driving me nuts too, but the answer is right here:
http://quatermain.tumblr.com/post/517122761/running-universal-ipad-iphone-apps-in-the-simulator
In short, tell Xcode to Build for the 3.2 SDK, then switch the build menu to the 3.1 SDK and tell Xcode to Run the app. Presto, the app starts in the iPhone simulator!
From Apple's documentation: "iPhone OS 3.2 does not support iPhone and iPod touch devices. It runs only on iPad." There's no way to target 3.2 for iPhone, so there's no Simulator. Ergo, you'll have to wait for iOS 4. Fortunately, that's only 4 days away now... of course it won't support the first generation of iPhone devices, but for all other iPhone users it's a free upgrade. Not sure about iPod Touches.
You should be able to change your target platform in your Project Settings.
Changing the target platform and device makes no difference. It always launches the iPad simulator.
If you switch the simulator to iPhone mode, the app just disappears.
This dev environment is a mess.
Short answer: You can change the hardware setting in the simulator. Hardware->Device
Go to Project
Set Active Executable
There are 2 options: Ipad Simulator 3.2 or Iphone Simulator 4.0.
If you choose the Iphone simulator, then it will launch Iphone simulator.
If you choose the Ipad simulator, then it will launch Ipad simulator.
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 away!

No iPad simulator in Xcode 3.2 beta 5

I installed Xcode 3.2 beta 5 and I could not find iPad Simulator. Where do I find it?
You are looking for the program iPhone Simulator.
If not, you can test your website in Safari on iPad using the iPhone Simulator (Hardware -> Device -> iPad).
Above is from Technical Note TN2262
If you can't find it via searchlight, than try looking in /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator
After you install the SDK successfully, Run Xcode and create a new project. Select iPad for product.
When you create an iPhone project for iPhone OS 3.2, you will see that every time you Build and Run it, it appears in the iPad simulator instead of the iPhone simulato
There is not much too see when you run the simulator without a project
Go to spotlight and search iOS Simulator. You run that and up pops an iPhone simulator, go to Hardware > Device and change it to an iPad
The iOS Simulator is in Mac HD > Developer > Platforms > iPhoneSimulator.platform > Developer > Applications > (here)
Nicely squirrelled away
Try creating an iPad project and ask to launch it in the simulator.
When running, go to the dock, right click on the icon and select "options".
In the "Options" menu is "Reveal in Finder", which will show you where the simulator currently lives.
Also be aware that the iPhone and iPad simulator are the same application, in the menu for the iPhone Simulator (the actual name of the app) you can select which device you want to simulate (though XCode will automatically switch this for you when you run in debug).
Perhaps this pertains,
From Xcode release notes found under the download selection:
Known Issues in Xcode 5 developer preview
Simulator
There is no iPad simulator support in this seed.