191

When I'm trying to run iOS application in Xcode 6 in iPhone 6 simulator, I'm getting error Unable to run app in Simulator.

And error code is:

An error was encountered while running (Domain = FBSOpenApplicationErrorDomain, Code = 4)

Can any one suggest how to resolve it?

enter image description here

1
  • Quite Simulator and Clean Project and run once again also worked for me. Sep 27, 2014 at 9:18

12 Answers 12

354

This worked for me:

iOS Simulator -> Reset Contents and Settings... -> Reset

menu bar screenshot

are you sure screenshot

referenced from Qiita: Unable to run app in Simulator エラーの対応方法.

4
  • 9
    Same here. Why this happens on the first run is really amateurish. We should expect more from Apple. Sep 25, 2014 at 15:33
  • 12
    Resetting has nothing to do with the solution. As mentioned in the Xcode release notes, this error is just from a race condition / timing bug in SpringBoard. The workaround is to just try again, and resetting the sim doesn't actually help. Oct 13, 2014 at 3:09
  • @JeremyHuddlestonSequoia is correct, without resetting, just quit the simulator and launch again, I solved the problem.
    – axl411
    Feb 7, 2015 at 5:50
  • This happens after someone changed provision profile of our project during a merge. The solution works for me.
    – evanchin
    Feb 17, 2015 at 21:34
44

Just closing the iOS Simulator worked for me.

There is not always the need to reset the iOS Simulator. I did not even had to close Xcode.

3
  • 2
    Much better than to reset
    – Saran
    Nov 27, 2014 at 19:47
  • It is working. Please force quit your simulation. It will work most of time otherwise Reset your simulator. Jan 7, 2015 at 8:47
  • 2
    - Quitting sim din't work. - Quitting XCode din't work. - Deleting app din't work - Resetting Sim din't work 😢 Sep 9, 2015 at 6:57
10

This happened to me once when I added some assets as symbolic links (through ln -sf). Even installing to devices was failing.

After I removed the links and made a hard copy, it worked and error was gone.

1
  • 1
    Boyhowdy yes, I really want to highlight this answer because, if this is your problem, none of these other 'reset/close/do a rain dance' answers are ever going to work! Mar 21, 2016 at 20:23
3

No need to quit the simulator or reset all content every time .

Just close the app on which you are working if running on background .

it works for me .

0
2

As mentioned in the Xcode release notes, this error (along with a couple others) results from a timing bug. The workaround is to just retry.

See https://developer.apple.com/library/prerelease/mac/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html#//apple_ref/doc/uid/TP40001051-CH4-SW1

Testing on iOS simulator may produce an error indicating that the application could not be installed or launched. Re-run testing or start another integration.

Also see:

https://devforums.apple.com/thread/248879?tstart=0

1

I just quit the simulator , cleaned up the project and ran again it worked.

0
1

Just quit the xcode6.0 beta or else and run project again, it worked for me.

0

Reseting the Xcode will delete some bad junk which simulator has cached, so reseting is good option to resolve this issue.

iOS Simulator -> Reset Contents and Settings.

2
  • This is a duplicate answer, because the proposed solution has already been suggested by @JeffWalters.
    – honk
    Nov 20, 2014 at 19:09
  • Not to mention, the answer is incorrect misinformation on top of that. Nov 27, 2014 at 19:39
0

Be careful if you skip installs. I accidentally changed Skip Install on the main target, when i meant to change it on a dependency . When changing it back I had to do a clean.

0

This problem probably started after we enabled background mode in our app.My solution :

1) Go to simulator
2) Hold cmd + shift
3) Tap 'H' key two times
4) Slide the application off to stop it running in the background.
5) Run again.

(Very tiring to have to repeat the above step each time I build and run)

-1

Open your app scheme setting and edit it as shown in attached screenshot, Actually you have to disable the "Launch Due to background fetch". Worked for me. Steps, 1. Select your target and select "edit scheme" 2. Select "Options" tab on right side of detail window 3. Uncheck "Launch Due to background fetch" checkbox.

1
  • There is a distressing lack of screenshot. Jun 19, 2015 at 0:41
-2

Disconnect hardware keyboard. In ios simulator main menu Hardware -> Keyboard -> Disconnect Hardware keyboard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.