137

I have created a Cordova 2.1.0 app, It ran fine for the first 2-3 times. But now when I am trying to run it through terminal it is giving me the following error.I didn't change anything.

Ankurs-Mac-mini:~ ankur$ /Users/ankur/Desktop/CordovaSMS/cordova/emulate 
Ankurs-Mac-mini:~ ankur$ 2012-10-17 16:11:08.695 ios-sim[7032:507] stderrPath: 
/Users/ankur/Desktop/CordovaSMS/cordova/console.log
2012-10-17 16:11:08.698 ios-sim[7032:507] stdoutPath: 
/Users/ankur/Desktop/CordovaSMS/cordova/console.log
[DEBUG] Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain 
Code=1 "iOS Simulator failed to install the application." UserInfo=0x7fc643902320 
{NSLocalizedDescription=iOS Simulator failed to install the application.,
DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}

any help would be appreciated. Thanks

Ankur Arya
  • 4,693
  • 5
  • 29
  • 50

17 Answers17

279

Solved the problem

Deleting contents of ~/Library/Application Support/iPhone Simulator and re-run the project solved this problem. or you can simply reset content and setting of the simulator.

enter image description here

Abdul Yasin
  • 3,480
  • 1
  • 28
  • 42
Ankur Arya
  • 4,693
  • 5
  • 29
  • 50
  • 7
    Thanks - that did the trick. Note that in my case the alternative, `iOS Simulator > Reset Content and Settings...`, was NOT enough; had to remove folder `~/Library/Application Support/iPhone Simulator/6.0` (I selectively removed for 6.0 - other iOS versions were unaffected in my case). – mklement0 Aug 02 '13 at 13:53
  • 41
    This doesn't work in iOS 7. You will always get this error if you switch from ios 7 simulator to ios 5 sim. Deleting the directory doesn't solve the problem - you need to reset content and settings. – CpnCrunch Aug 02 '13 at 21:08
  • That's the same than remove the app from simulator, but in that case you remove all apps in all simulator. – xarly Sep 19 '13 at 09:30
  • @Ankur just added your 100th vote.. Congrats on the Great answer badge – Krishnabhadra Sep 23 '13 at 07:10
  • 2
    Awesome job, was giving me a major headache until I came across this solution, many thanks ! – Izzy Manpo Oct 05 '13 at 15:33
  • I tried deleting the app from simulator and also using Reset Contents but neither did anything. I had to physically delete the contents of this `~/Library/Application Support/iPhone Simulator` and also the derived data to get it to work again. I also have to close and restart Xcode as well. Very annoying because I have to do this each time I want to run the app in the simulator. – jsherk Oct 30 '13 at 14:53
  • I can't find /library/ – Andrei Cristian Prodan Dec 23 '13 at 16:13
  • "Resent Content Settings" does the trick but for large applications where lots of data is created/downloaded inside app, its always a headache, you have to recreate/re-download the data again and again to continue testing the app. Hope there is another solution exists which does not say "Reset Content Settings". – dev gr Feb 06 '14 at 11:46
  • @devgr : i dont think you will use simulator for large number of applications. Better use device – Abdul Yasin Mar 05 '14 at 08:49
  • This is only temporary solution. Problem will go back until you apply this solution: http://stackoverflow.com/a/22549425/229229 – Lukasz Jul 04 '14 at 09:36
101

Try manually launch the iOS Simulator and from the "iOS Simulator" menu, click "Reset content and settings", then close and rebuild your app.

enter image description here

Abdul Yasin
  • 3,480
  • 1
  • 28
  • 42
  • 1
    Best answer. it fixed my all related problems. – Abdul Yasin Jun 28 '13 at 12:18
  • 2
    Unfortunately this deletes all apps installed on the Simulator. :-( – FishStix Sep 14 '13 at 16:56
  • 2
    Yeah, FishStix. It just reset your simulator and deletes all the apps. If you prefer to retain the apps , try manually deleting the individual app data from iphone simulator which can be found in Finder. Hope i am helpful to you. Thanks – Abdul Yasin Oct 03 '13 at 13:01
33

My solution is:

reset

From menu, iOS Simulator, Reset Content and Settings. Close XCode 5.0: close project and close it from Dock and re-open the project and launch again, like in Windows :)

  • 1
    Worked for me in XCode 5, when switching from iOS 7 simulator to 6.x and it suddenly stopped working. – Vern Jensen Oct 04 '13 at 21:03
  • switching to simulator 6.1 and from 6.1 need this very often. Need to make a shortcut key. I have a few screens and need to test with 6.0, 6.1, 7.0. When I am going to 6.1 and from there better to reset –  Oct 11 '13 at 17:22
  • This works great. I had to do a project - clean also. – verma Nov 02 '13 at 14:24
20

I tried everything mentioned above and nothing worked. My problem was iOS 7 specific. I was finally able to resolve the issue by assigning a non-empty value to Bundle versions string, short (CFBundleShortVersionString) in the -Info.plist file. Looks like iOS 7 doesn't like an empty value for the build number. I had a script that auto increments the bundle number by 1 every time I build the project so this field was empty. I just assigned a dummy value there to get it working.

indiantroy
  • 1,503
  • 1
  • 15
  • 25
  • This wasn't quite my problem, but your answer prompted me to _change_ my existing value, which worked like a charm. Upvoted. – Paul Bruneau Oct 23 '13 at 20:51
  • This was exactly the problem for me. I had just realized that we were not using the Build field correctly, and in our work flow, we don't have any use for it. So I cleared the Build field, but then started getting this error, and resetting the simulator doesn't fix it. Putting a value (I just chose "A") in the Build field fixed it. – Joe Strout Mar 04 '14 at 20:36
  • Crazily it will happily allow you to build for distribution without this value. Thanks for the solution! – Rich Tolley Oct 24 '14 at 15:35
12

You can also remove the app from the simulator.

This worked for me in iOS6.1

xarly
  • 2,054
  • 4
  • 24
  • 40
12

Solved here: https://stackoverflow.com/a/16279286/1927253

I copied a folder into XCode 4.6.2 with the name "Resources". When XCode asked, I created the folder references for any added folders.

Every time I did this, I would have to goto the Derived applications directory, and delete the build directory for my project to get it working again.

Solution: Do not copy a folder by reference into XCode with the name "Resources". Rename it to something else other than Resources.

Very annoying error.

Community
  • 1
  • 1
Robert Wasmann
  • 897
  • 7
  • 17
  • This bug is still present in Xcode 5 and this fixed it for me. Upvoted. Have you filed any radars that I can duplicate? – Andrew Apr 15 '14 at 12:40
  • 2
    Confirmed as still present for Xcode v5.1.1. This probably would have taken me hours to find the root cause of if not for this answer. – Jordan Mack Apr 29 '14 at 02:41
  • Too bad I didn't find this answer before... I lost half a day figuring out that my referenced folder is the cause. Though I didn't know it's because of its name. BTW. It worked fine in iOS 6.1 simulator but not 7.1. – atablash Jun 04 '14 at 09:03
5

just reset your simulator and re-run your project

hardik hadwani
  • 556
  • 6
  • 24
5

Unfortunately none of these solutions solved my problem. I did everything, even restarting my mac but it was still failing. What actually did solve my problem was to go to the Organizer and delete the Derived Data and Snapshots.enter image description here

appostolis
  • 2,294
  • 2
  • 13
  • 15
3

Had the same problem after installing XCode 5. Had no iOS 6.1 Sim or SDK. Obtained these. Tried to run the App up under the iOS6.1 Sim and go the failed to install message. Having read through all of the above posts, I decided to simply remove the App from the Simulator and re-istall, re-run from the project window and that solved it for me.

Carl Hine
  • 1,817
  • 18
  • 24
2

I tried ALL these things and more including reinstalling Xcode 5 and nuking every xcode and simulator preference/application support file with no luck.

Then for the hell of it, I CHANGED my short bundle version string (it already had a value, it was not empty), and it fired right up.

3 hours gone but yeah

Paul Bruneau
  • 1,026
  • 1
  • 9
  • 15
1

All the answers I looked for do not work for me!. Finally The only way to make it work is as follows

  • 1.Check the version of titanium being used for the project in tiapp.xml
  • 2.right click the prject in the project explorer window.
  • 3.Select Properties
  • 4.Choose project build path. Select Titanium Mobile SDk all versions of 3.* Tick all of them.
  • 5.Now click apply and re run the project.
Popeye
  • 11,839
  • 9
  • 58
  • 91
Sarvesh
  • 1,152
  • 2
  • 11
  • 25
1

None of the above worked for me, I finally compared my info.plist to another project and found that I had somehow deleted the "Executable File = ${EXECUTABLE_NAME}" key/value pair, replacing it fixed the problem for me.

Patrick T Nelson
  • 1,234
  • 12
  • 21
1

This error occurs on iOS 7.0 if you leave the "Build" empty. Enter a build number!

0

What worked for me was to simply delete an old version of the app, which was made in a prior version of Xcode (likely 4, now running 5) from the simulator (tap-hold, jiggle, x).

EPage_Ed
  • 1,173
  • 11
  • 11
0

I encountered this problem while trying to create a build for Facebook application approval. I found that for some reason, when I used the following command line:

xcodebuild -arch i386 -sdk iphonesimulator7.1 -scheme Mana -configuration Release

the files didn't end up in [project root]/build/... (as the instructions on Facebook suggest), but in ~/Library/Developer/Xcode/DerivedData/[app name + unique identifier]/Build/Products.

I'm not sure exactly what's going on here (anyone who knows more please enlighten me!) but I was able to run the files in the DerivedData directory on the simulator. Hopefully they'll also work for Facebook!

Jeremy Warne
  • 3,437
  • 2
  • 30
  • 28
0

I tried everything mentioned above and nothing worked.

Finally the only way to make it work was unsetting DYLD_INSERT_LIBRARIES=/usr/lib/libimckit.dylib

How I did this:

  1. Open terminal and typing "sudo vi /etc/launchd.conf"
  2. Changing

"setenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib"

to

"unsetenv DYLD_INSERT_LIBRARIES /usr/lib/libimckit.dylib"

  1. Save changes
  2. Reboot your system

In this post [1] explain what DYLD_INSERT_LIBRARIES is for

[1] https://stackoverflow.com/a/26053165/2091181

Community
  • 1
  • 1
Jorge Casariego
  • 21,948
  • 6
  • 90
  • 97
0

On Mavericks 10.9.5 using Xcode Version 6.0.1 (6A317) with an iOS SDK supporting 8.0 originally had Simulators all version 8 all getting this error. All the advice above was not working for me. So went to Xcode->Preferences->Downloads and saw as installable (but not yot installed) in the Components section were iOS Simulators 7.1 and/or 7.0. Went ahead and installed the 7.1 Simulators and got extra designations on the Product->Destination list Simulators of version 8.0 and 7.1, and using the 8.0 still had the same error, but the 7.1 Simulators all worked.