For some reason the iPhone simulator takes several seconds (~12-13s) to start my app when I run it in iOS 6.0 or 6.1 mode (that's before the app's default screen appears, so it doesn't seem to be caused by the app's code). I think that's actually slower than when I start the app on the device. If I switch to 5.0 or 5.1 it takes just 2-3 seconds.
Has anyone else noticed this? Any solutions? (I've cleared the whole ~/Application Support/iPhone Simulator directory, but it didn't help.)
You can select iOS Simulator from top menu. After it you can Reset Contents and Settings (third from top). it will reset you simulator. Remove all application from your simulator. Please try after it.
Related
Somehow my iPhone Simulator is unable to play sounds. First an app I'm working on using AudioServicesPlaySystemSound() stopped working.. I spent a while debugging this but sound is still working on the iPhone when I run the app on the device. I get the same results with other iPhone apps such as the sample Crash Landing app.
I can't find a sound setting anywhere in the simulator or Xcode preferences. I've tried resetting the simulator through "Reset Content and Settings" menu item to no avail.
On your Mac, go to System Preferences > Sound > Sound Effects and then uncheck and recheck "Play user interface sound effects".
You need to re-activate your system sounds, see the end of this page.
I had no sound in the simulator, so I tested it with mobile safari and tried playing an mp3: No sound!
All the above tips didn't help. Eventually, I changed my INPUT source from the virtual soundflower device to Line-In, and the Simulator worked!
So, even if the app wasn't using input, it didn't work well with Soundflower.
I've seen this problem after my update from OSX10.5.7 to 10.6.2
And I made the following changes to make the simulater sing again:
Goto "Applications/Utilities" and run "Audio MIDI Setup", then change midi format from 48000 to 44100.
OpenAL not working on the simulator was fixed with the 2.1 SDK. Make sure Active SDK and Active Executable are set to 2.1.
By the way, make sure you're using the last version of CrashLanding (v1.8). Some nasty leaks in SoundEngine were fixed recently.
I've found sound to be very inconsistent in the simulator (2.1 SDK). Sometimes it works, sometimes it doesn't. Even when it does work, it's usually very choppy and distorted (when playing audio files such as mp3).
A few things to remember:
call AudioSessionInitialize as soon as your app finishes launching
set the kAudioSessionProperty_AudioCategory property for the session via AudioSessionSetProperty (with a value such as kAudioSessionCategory_MediaPlayback)
call AudioSessionSetActive(YES)
Of course when all else fails, just run it on your hardware!
EDIT: Now that the 2.2 SDK has been released, I haven't had any problems with sound in the simulator. They must have fixed the bugs! I highly recommend you upgrade to the 2.2 SDK.
if reactivating system sounds didn't work for you try this:
launch audio-midi-setup, then configure your "built in output" to use 44.100Hz, 2 channels, 24 bits. (from http://www.cocos2d-iphone.org/forum/topic/4159)
somehow after a few days, my iphone simulator now wants 48.000Hz, 2 channels, 24 bits.
just play with it for a bit and be warned that it might change randomly when plugging in headphones, going to standby, restarting, etc.
and here's a an off-topic hint: when you plug headphones into your iphone/ipad the buffer size might double (e.g. from 512bytes to 1024 bytes), make sure you don't rely on the buffersize you requested!
I'm encountering this issue while running a watchOS simulator. In my case, the following worked:
Close the simulator in which the sound doesn't work.
Open another watchOS simulator.
Close it and reopen the original one.
Here are two other possible reasons why sound might not play on simulator devices:
With Xcode 14.2 and simulators running iPadOS 16 / iOS 16, I noticed that sound was playing on iPad simulators, but not iPhone simulators. It turned out that this was related to the AVAudioSession.Category being set on the AVAudioSession. If the category is .ambient then sound plays on iPad but not iPhone simulators, if the category is .playback then it plays on both. Interestingly, this does not seems to be a issue for iOS 15, here .ambient category plays on iPhone simulators too.
If you are calling AVAudioPlayer.play(atTime: TimeInterval) then the TimeInterval you pass in must be later than the device's current time. Passing 0 will not work and just plays nothing. Even passing a value > 0 may play nothing, you need to add the time offset to the deviceCurrentTime on the player. See the associated documentation for an example. This applies to real devices too of course, not just simulators.
At the time of star coding in xcode 5, one thing that i struggle with is, with out any coding error or other reason my all applications got crash whenever i try to reset my "Simulator"!!! Not all the time, but most of the time it crashed. Some times it crashed at the time of quit. No matter with which version of simulator i using (iPhone Retina 3.5 Inch, iPhone Retina 4 Inch with iOS6 or iOS7). It always happen when a complete project (with no error, nothing) built on xcode 4.6 trying to quit after running in xcode 5. Though i keep the "Simulator version" as like in xcode 4.6.
If any one similar with this problem and have solution, please share it with me.
- Thanks a lot in advanced.
The error i am facing is : "Thread 1:signal SIGTERM"
Once you open your project with Xcode5 then all the settings for the views are changed to open with Xcode5, in order to make your project views to open with previous versions of xcode, you need to change the property of the views in file inspector to open with earlier versions default, by doing that your project would open in previous as well as current xcode version.
You could fix it in file inspector to open the views with the previous versions of Xcode if it is selected as Xcode5(Default(5.0)), by following image you could fix your views to open with the earlier versions of the xcode.
When I run my app on the simulator, every time a white blank screen would be generated. but after I black iPhone button on the bottom to exit the app, the views will then be visible after you re-enter the app. then the app run as usual.
But the situation is different when I load it into my iPhone.
Only BLACK blank screen can be seen into the app. after I exit the app and re-enter it, still nothing can be seen, and the app would automatically exit, too.
I dunno why it would be like that as simulator just simulate the real iPhone.
Here is some information:
iOS version of my iPhone: iOS 5
XCode version: XCode 4.2
Hope someone can help me. Thanks a lot.
Make sure that your Base SDK is as high or higher than your current version. Change it in your target settings and your project settings. Also change your compiler to Apple LLVM and your debugger (under edit scheme) to LLDB.
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!
iPhone simulator is running on my Mac but it's not showing the simulator. Two days back I had installed the Mac OS X 10.5.6 update. Xcode is launching the aplication in simulator, and it's running, as I can see the outputs on the gdb console window. But the simulator is not shown.
Try to remove ~/Library/Preferences/com.apple.iphonesimulator.plist
Had the same issue. The simulator was running somewhere way off screen. Could see it using expose, but couldn't move it.
Rather than using "Detect Displays", which didn't work for me, I changed the screen resolution and that popped it back into place.
Have you previously had an external monitor connected? Perhaps Mac OS X saved the simulator window off-screen the last time it was run?
In the System Preferences, select Displays and click the "Detect Displays" button while the simulator is running. That should force the simulator window to appear on-screen.
Nothing worked except the good old IT joke, Turn it off & on again! (Completely restarting the whole machine worked for me).