Failed to launch simulated application: iOS Simulator failed to install the application - iphone

When I create a new window based application, I get:
Failed to launch simulated
application: iOS Simulator failed to
install the application.
I tried to do what this post suggest, but didn't work
Any suggestions? I haven't tried re-installing xcode yet.

Choose Reset Content and Settings in the File menu of the Simulator.
Build Clean in Xcode
Then try again.

I'm not sure why, but rebooting my machine seemed to fix it.

I had the same problem. A reboot also did the trick, but then I realized that the directory
~/Library/Application Support/iPhone Simulator/6.1/
looked "different" after the reboot (Directory "Root" was missing). So I tried to reproduce the error by deleting the directory or parts of it. The simulator each time recreated the directory and worked fine. Maybe the reboot is not really needed just recreating the mentioned directory would also help.

Try to delete project.xcworkspace file and xcuserdata dirctory in your project

It seems that the processes don't get cleaned up properly each time you stop the app with ps aux in Terminal showing a large number of processes representing your app on the simulator.
I expect some kind of upper limit is reached with the number of processes / memory. (Indeed I have found that XCode will fail to build because some posix resource can't be found because there isn't memory to load it)
A machine restart clears all of these dead processes and allows room for new ones. For me, I only have to do this after about 2-3 weeks of not turning my computer off, but I suppose what resources you have and how often you use the Simulator will affect it.
If someone knows how to clear all these dead processes without restarting, that would be useful please, killall ... doesn't seem to have worked for me, but feel free to add to this answer.

Simply go the info.plist file property and set 'Copy to Output Directory' to 'Copy Always' it will resolve your problem.

Related

Error launching remote program: No such file or directory

Anyone have an idea about this
Error launching remote program: No such file or directory (/Users/muself/Library/Developer/Xcode/DerivedData/myproject-hlelojuljidnnagbdqzliazpdgmn/Build/Products/Debug-iphoneos/myproject.app/myproject).
The project was working fine with the previous Xcode versions. I have just updated the Xcode to Version 4.3.2 (4E2002), & the error start coming.
I have search on the web, and tried a lot of the options like
Quit Xcode, clear the Derived Data folder, restart the Xcode.
Rename the project,
Reset the device,etc
I also tried this on another machine but did not work, the same problem occurs.
But one thing i have some other projects as well and they are working fine.
Thanks for at least reading this.
First try restarting Xcode. If it doesn't work, then try hard reset of your device. This happens to me when I change the bundle identifier of my app.
This solution,I found of the above problem its working fine for me.:)
have you tried to "validate settings" (button on the bottom of project settings)? Do you use some static libs in your app? – Vov4yk
Check your deployment target. I am running Xcode 4.5, and it gave me that cryptic message, while the reason was that my iPad is running version 5.1.1, and my app was set with deployment target of 6.0.
I also get same problem. This below solution works for me.
Thats really annoying. This error happens in a number of different situations. Sometime restarting the Xcode, fixes the problem. If not, follow these steps:
Disconnect your device.
Delete the app from your device.
Quit xcode (Don't just simply close the window, quit it)
Delete derived data folder (~/Library/Developer/Xcode/DerivedData/APPNAME -gbrvhlvwmpiobxdujegtghggrffp - or something like that)
Now start Xcode, connect device and run the project. It should work fine.
Source: http://dhilipsiva.com/2012/07/24/xcode-could-not-launch-app-no-such-file-or-directory-error.html
Hard reset of the device fixed it for me. i.e. power off and back on.
Quitting Xcode, disconnecting, reconnecting the device etc didn't.
The error occurred just after I had created a new project with the a duplicate Bundle Identifier to another. Both apps coexist OK on the device/ in Xcode, but this does seem to cause the above issue.
I saw this when I let the build configuration set up as ad-hoc. After I put it back to Debug it worked fine.

Xcode compiles my App, but can't run it in the simulator

when i compile my app, Xcode just says "Attaching to Projectname..." and gets stuck there.
The debugger just prints this out:
error: failed to attach to process ID 0
I tried to clean & build again and it still doesn't work out. I googled but couldn't find anything helpful.
How can I fix this problem? Thank You!
The solution for me was to delete everything Xcode has generated earlier:
the App on the Simulator...if this is not possible because you cant
reach the Homescreen, you can delete the App directly under
~/Library/Application Support/iPhoneSimulator/6.0/Applications
delete the Derived Data in the Organizer under Projects or directly
in ~/Library/Developer/Xcode/DerivedData
clean the Build Folder by choosing "Product" in the MenuBar and click
while you press the Alt-key on "Clean Build Folder"
Restart Xcode
Have you tried closing down the simulator entirely, or failing that, reset the simulator and all its contents usually does the trick.
What finally got the simulator working again for me was deleting everything under Library/Application Support/iPhone Simulator/ within the user directory. What I think caused the problem for me in the first place was trying to use a directory named 'Resources' as described here: https://stackoverflow.com/a/1265168/649
This happened to me when I had two xcode projects open with the same bundle identifier.
Solution: leave only one project open which has the same bundle id.
Lindemann's solution worked for me. Nonetheless, during further development I came across another situation that generates this problem: if you create a folder reference (blue folder on Xcode's file explorer, as opposed to the yellow ones which are just groups) called "Resources" the same issue will arise. The solution in this case is to simply rename that folder.
After this, follow Lindemann's solution.
I had similar issues when i installed XCode 4.5 on OS X Mountain Lion. I searched a while and tried some fixes but what finally solved the problem was adding "127.0.0.1 localhost" to my hosts file (/etc/hosts).
Here is what i have done:
Open a terminal shell with cmd+space > terminal
type in "cd /etc"
type in "sudo nano hosts"
type in your root password
add "127.0.0.1 localhost"
save with ctrl+o > return
close with ctrl+x
log out and log in again or restart
Ctrl-Shift-Option-K (same as holding down option and selecting Product ... Clean Build Folder) has always worked for me.
What seemed to work for me was build & run my code so that it opened the Simulator, then hold down on the Simulator Icon in the Dock and select Options -> Keep In Dock
After this I just closed the simulator and launched it from the dock and deleted the app from the home screen on the simulator.
Build & Run the app from XCode and everything seemed to be OK again.
There seems to be quite a lot of things that can cause this error, but for me it turned out to be that I was missing the key CFBundleIdentifier from my plist.
Added it back, and the simulator started normally.
Also make sure none of your file/group name collide with the projects default settings.
Things started breaking for me when I added an info.plist file to my project (Bad Idea). Same happens when you add a "Resource" Group. I don't have an exhaustive list, but if someone does please do share.
Cleaning out / Renaming these conflicting files and following the solution provided by Lindemann(https://stackoverflow.com/a/12504712/2069749) solved the problem for me.
What worked for me was that I realized i was messing with the project settings and accidently removed the info-plist section. After specifying the plist file again properly, it worked. Hope that helps someone.
You need to change the debbugger LLDB to GDB. This helped me start my program in the simulator.
If you are using a network account, you should replace the "~/Library/Application Support/iPhone Simulator" with a link to a local directory. This worked for me after trying everything else.
Make sure you do not have an invalid build rule, that will cause this error, happened to me once (I had added a build rule by mistake and left it invalid).
I had the same problem, in my case i have left the ios simulator open in one user account and switched (without logout the previous one) to another user account. I couldn't event able to open ios simulator to clear and reset its settings. [Shows could no open ios simulator OSStatus - 10829]
My solution:
I quit the simulator in the first user account and then came back to second user account, every thing is working fine.
try to do next steps:
Go to Product/Scheme/Edit Scheme then select Run section.
Select Info Tan and set Debugger None.
Run project. It must be working (without debugger)
Go back to Edit Scheme and selecet debugger LLDB
Run project. It is working.
Maybe additionally you need to delete derived data and do Product/Clean
Can't tell you how frustrated I am trying to narrow down the cause of this one. Took me hours. Trial and error here and there.. all leads to nothing until one comment in one of the threads relating to this mentioned about "Executable". Boom! I remember the plist key "Executable file" in my project plist (PROJECT-info.plist). So I got there and found out that that entry was missing. I filled it in with whatever default you see when creating new project, "Executable file" paired with "${EXECUTABLE_NAME}". Build + Run. Then it finally worked!
Btw, I did try all those deleting/resetting stuff found all over SO. None of them works.
If resetting content and settings in the Simulator doe snot work for you, make sure that there is an entry for localhost in your /etc/hosts file:
127.0.0.1 localhost
Some programs can delete the line or comment it out (#) or even delete your /etc/hosts/ file completely. I tried everything described, but once I added localhost back to the file, the simulator worked perfectly for me.
What worked for me was to select 'Delete Derived Data' from the Projects tab in the organiser.
I fixed my problem by I making a new blank project and importing all the old files.
It must have been a problem with Xcode because it worked before iOS 5.1.

Xcode 4.2. gets stuck "Attaching to myapp" when running

In xcode 4.2, sometimes when you're going to run your ios proj on simulator, the status windows says "Attaching to myapp", and just gets stuck there... until you cancel.
Now, this has been asked before:
XCode 4 hangs at "Attaching to (app name)"
and surprisingly, besides the accepted answer on that thread, there are at least 10 other possible solutions others have been adding, all for the same issue, people says one of them worked while the others didn't...
please note, this is not a sequence of steps. each one is a possible solution:
1- restart xcode and/or restart simulator (reset content and settings) and/or restart computer.
2- click on project name in project navigator. in build settings tab, go to packaging and make sure that "Product Name" is the same that the one xcode says simulator is attaching to when running. if they are different, it will fail.
3- go to your projectname.xcodeproj folder. inside there delete anything named with your userid. when you reopen xcode those files will be recreated and it should work…
4- Manually delete the build directory for your project.
5- Go to organizer window. select Projects, select your app in the left hand side and then delete over "Derived Data"
6- Check Launch option is set to "Automatically" in Product->Edit Scheme, "Run" scheme.
7- In Project->"Edit Schemes"->Run. Change the Debugger from GDB to None (this doesn't make sense to me..).
8- Kill the process gdb-i386-apple-darwin from Activity Monitor. this is assuming gdb is not responding.
9- In "Product"->Edit Scheme. in Run, click yourappname.app, choose other, navigate to your .app in your project. now run.
10- Check that you don't have two different Info.plist in your project. if you do, remove the bad one.
In my case, none of them do the job. My project builds succesfully, everything seems fine, .plist, bundle identifier, name, etc.. and still can't pass the "attaching" part. i don't understand the reason of this, so any suggestions to fix it and possibly understand the problem i'll really appreciate it.
New projects were failing to launch in the simulator, getting stuck on the attach step.
This seems to be after Xcode 4.3 was installed, but I can't recall the last new project I created.
This is what worked for me, the clue coming from this thread...
Project->"Edit Schemes"->Run. Change the Debugger from LLDB to GDB
Another computer with the same version of Xcode works fine. Maybe my LLDB is corrupt?
Did you recently upgrade to OSX 10.7.2? I started having the same problem after I upgraded. I noticed that the Simulator always get stuck if I'm connected to a Wi-Fi network that forces Captive Portal authentication. This happens with other apps as well (Chrome, Safari). I'm not really sure why this happens, but I did read that 10.7.2 has issues with Captive Portal authentication.
Anyway, in my case, I repaired disk permission from Disk Utility and rebooted my machine. This seems to resolve the issue.
Just rebooting the computer worked for me.
Tried all the solutions but none applied to my case. XCode 4.2, OS X 10.6.8
Found that the Info.plist bundle identifier had been accidentally deleted when adding a custom app icon. Adding that back fixed the problem.
Anyway that's my fix, hope it helps someone.
Also before figuring out that, found I could start the simulator from another app and then use the app icon on the simulator for the app that would not attach, and start it up that way.
seems like there seem to be a lot of things causing this, but one thing that worked for me was simply cleaning out the build folder by pressing Cmd+Option+Shift+K or alternately if you select the Product dropdown in the toolbar and hold the Option button you should see the "Clean Build Folder" option appear
I also tried all solutions in that topic but all failed. But finally it was found out that what was went wrong.
What made this issue occurred is that some settings in Target->Build Settings was got modified by me for including C headers. And after I added all C headers and make it built. This issue occurred.
It might be only works on the situation I described before.
I just created an empty project and check all items in Target->Build Settings between the attaching-stuck app and the empty one. It was found that some items in the attaching-stuck one was different from the empty one.
So I deleted it and make it attached successfully.
It seems different in my case and also solved in a different way. If you got stuck every time after drop some files or folders into your project with the 'Create folder references for any added folders' way, this will be the solution.
Click the project node(the root node) on Xcode's project navigator and select target node. It's under the 'TARGETS'. Then click the 'Build Phases' tab. There are 4 sections of some list and you can click the triangle to expand the list.
You need to concentrate on the 'Compile Sources' and 'Copy Bundle Resources' section. Code files like .m must be placed on the 'Compile Sources' section and are compiled automatically. Resource files like .jpg must be placed on the 'Copy Bundle Resources' section and are copied into the project's package.
So, if the dropped files and folders are not in the 'Copy Bundle Resources' list, just drag it form the project navigator and drop onto the list. That will solve the problem.
If it doesn't work, delete all the referenced files and folders, click '+' button on the resource (or compile) section and click 'Add other...' button. Then you can include files and folders as the 'Create folder references for any added folders' way. I think the 'drag and drop' works well after the '+ button' way is done once.
In addition, 'Resource' may not allowed for folder name.
I experienced the 'stuck' problem every time when I attach files and folders as reference on Xcode 4.2 ~ 4.3.3. Reinstalling mac was a useless effort for me.
I have noted in Lion that when the iOS sim locks up or hangs the app,
that if I go to a shell, and do ps -ef |grep SDK, I will
see many, many processes running associated with the simulator.
I tried to kill off these processes but they rapidly respawn
and the only solution then is to reboot. Also, in the ps output,
you will also see instances of your app running as well.
So the Simulator issue is caused by previously running processes
that appear to block the correct running of the latest one.
I guess Apple will have a fix for this eventually, as it is quite onerous.
Rebooting works for me, too, but this shouldn't be necessary. I'd recommend filing a bug at bugreport.apple.com. You can duplicate the one I created - the more it's duplicated, the more likely Apple is to fix the problem.
I tried all of the solutions above but without luck ...
When I search for simular problem here :
Xcode error: failed to launch [directory] -- invalid host string: 'localhost'
I found it fixed my problem!
Hope this helps those who are still searching for a clue .
Upgrading to XCode 4.6.2 resolved this issue for me
Even if the app is not attaching after cleaning the project, changing the app name, restart the by resetting the simulator, and if you are using LLDB compiler, it is because the LLDB compiler is not able to connect to the local debug server in order to solve this, take a look at this
Why does the LLDB Debugger constantly fail to attach?
This really solves your problem!

App won't launch on device or simulator

So... this is beyond strange.
I had an app that was running perfectly fine in simulator and on device. I've actually already submitted the app and it is for sale in the App Store.
Today I went back in and made a few changes for an update.
The app now will not load on my device and it won't load in the simulator.
In the simulator it says "Attaching to app_name" (it lists the actual app name) and it stays on this process of "Attaching" indefinitely, while the Simulator screen is entirely black.
When running the app on the device it says "Build Succeeded", then "Finished running app_name" without anything ever showing up on the device.
I restarted XCode and tried restarting my computer, but still no luck...
Other apps do work, but not this one.
Any ideas?
EDIT: I just started a brand new project, copied over all the assets and code, tried running and STILL the same thing happened. I thought for sure creating the project anew would work...
FINAL EDIT: After running "Clean", deleting the DerivedData folder, and restarting my computer a SECOND time, the new project (with all assets copied over) is now working. The original project still does not work. So I am not sure what caused the issue and what fixed the issue, but for me at least I can now move on. What do I do with this thread? Can it just be deleted? Thanks everyone who chimed in to try and help!
Tried above options but didn't work for me.
Finally, Just Resetting Simulator did the trick.
In the options move the DerivedData into your project directory. Whenever I have problems with xcode4 I just quit it and delete this directory. It contains the builds and caches of the background compiles that xcode4 does.
Deleting this folder usually fixes all problems I get.
Try cleaning your project. In Xcode 4: Product menu >> Clean.
Why don't you try this one.you can quit the simulator and run the project again.This works for me
There are a lot of different solutions people suggest for this:
Do a clean
Reset simulator
Do a 'clean build folder' (hold down option key when selecting clean)
Remove ~/Library/Developer Tools/Xcode/Derived Data/YourProject*
Remove your 'xcuserdata' directory inside your .xcodeproj directory
I just spent an hour trying different combinations of the items above, doing all of them, ... nothing worked. My app would either 1) Immediately start and quit before launch screen would show up, or 2) Hang at launch screen. The simulator took forever to reset, sometimes wouldn't respond to a Quit, ... Just really odd stuff going on.
This solved my problem: Reboot machine.
(It blows my mind this had to be done on Mac OS, but it worked. This may have something to do with upgrading to XCode 4.6 and not rebooting since then, I'm not sure... But I'm back running again)
Tried all posts here without success. Then I found something that worked for me:
I had a ~3000 resources folder in my Xcode Project.
At first I had them as "folder reference", which made XCode unable to launch the app.
When I switched them to be a "group" in the project, the error was gone.
I still needed to restart Xcode and the Simulator and rebuild, but it worked.

iPhone Simulator: SpringBoard failed to launch application with error: 7

Building an iPhone project results in:
Failed to launch simulated application: SpringBoard failed to launch application with error: 7
And the app doesn't install on the simulator. What's this all about? What's SpringBoard and what is error 7?
I had the exact same problem - I reset the iphone simulator and then quit the simulator (i.e. command q) then started it again.
Worked.
Boy, is the answer to this one hard to find, but I came up with a workaround. The simulator gives this error if it has any problems with accessing files in ~/Library/Application Support/iPhone Simulator/. This could be a permissions problem, but in my case it was even more subtle: my home directory is NFS mounted, and that seems to somehow be the source of the problem.
The basic workaround is to create a directory local to the machine, and link the iPhone Simulator's directory to that local directory. You shouldn't need to move your source files or project directory; it's just the simulator targets that are the problem.
Here is one series of steps to accomplish the workaround, to be typed in at the terminal
(1-3 done on every machine you'll be developing on, 4-6 once in your NFS-mounted home directory):
sudo mkdir /usr/local/iphone-dirs
sudo chmod 777 /usr/local/iphone-dirs
mkdir /usr/local/iphone-dirs/my-dir
cd "~/Library/Application Support/"
rm -rf "iPhone Simulator/"
ln -s /usr/local/iphone-dirs/my-dir/ "iPhone Simulator"
There are obviously many variations on this theme; I suspect that using a locally-hosted directory in /tmp would be fine (and not require admin privs, but would have to be redone every time the system is rebooted). As given, steps 1 and 2 are good if you will have multiple users using these machines that you don't want to collide with each other. If you have your own personal machine but NFS-mount your homedir, you could probably just skip to something like step 3 (and sudo it). Just make sure that whatever dir you create in step 3 is the dir that you symlink to in step 6.
No need to quite the simulator or delete the app..
Just select simulator, press command + shift + h + h and remove the app from background process(long press on app icon) then run your app again.
I started with a new project in Xcode and got the error 3 message, but otherwise same deal. New damn project - so no problems with broken code I added or name mistakes or anything else. But the app would build but fail to run in Simulator with the Springboard -3 error code. I've seen this before lots of times, and the basic kill-the-app-in-simulator, clean-and-run would work, but not this time.
Turns out my old 2007 iMac barely has enough RAM and disk space free any more. I'm running Mavericks, and I hid everything but Xcode and the Simulator, then ran a memory cleaning utility to free up every bit of RAM available (got back up to 1GB free or so), and then the app runs in the Simulator without a hitch. No more Springboard error.
I hadn't seen "too little RAM" listed as a reason for this error yet, so this may be useful for somebody else.
Springboard is the app that launches apps. It's the home screen of the iPhone. I had tons of problems when I tried to get my app running on the phone -- turns out that I had an older version of the SDK that was incompatible with the version of the OS my phone had. Reinstalling the latest SDK did the trick.
Also, have heard that clearing the XCode cache sometimes helps (didn't for me) -- XCode menu->Clear cache...
Maybe this will help: http://discussions.apple.com/thread.jspa?threadID=1605042&tstart=72
I had similar issues when I was trying to install my current development on the iPhone and this information about the AppID fixed it.
For quick reference, the AppID you created when you started creating certificates for development and provisioning of your iphone asked you to create a reverse domain name identifier. Something like: QS32H9XPNE.domain.subdomain.companyname.*
To correctly link up your application to the AppID would require you to set the identifier in the application to domain.subdomain.companyname.application.*
Hope this helps
I had the same problem but this solution works...!!!
1)Deleting the app from simulator.
2)Quitting simulator.
3)Restart simulator.
XCode menu->Clear cache solved my problem.
This happens to me when i switch from testing on the device to testing on simulator. Restarting Xcode and simulator gets rid of this error for me.Silly.
I initially solved this by restarting the iPhone Simulator. But this shouldn't be the answer.
The error came from editing the info plist.
Check that you didn't change any values that were set before provisioning your app for your device.
I wanted to change my Bundle Identifier, but had to go back to the default one after having this error.
Now it's fixed.
Next step will be to get a new provision Id with the Bundle Id changed.
I had same problem, the Simulator would just hang. This is on a fresh install of XC 3.2.5 GM and using Simulator with 4.2 SDK. Apps would run fine on a real device but the simulator would just hang.
I ended up changing the iPhone App Support directory and all sub dirs to 777 access permissions. Not a great idea to 777 -R, but I was desperate and it worked.
$sudo chmod -R 777 ~/Library/Application Support/iPhone Simulator/
For me this was solution. If you have enable background fetch mode. Remove this option if you are getting this alert during run app in simulator.
I had the same problem.
It happens as follow...
I had a folder storing images in some sub-folders.
If I add the root image folder as "directory", I receive this error.
If I add the root image folder as "group", simulator runs fine.
weird...
It happens to be related to folder name as well. My image folder was originally named "contents" and I got the error described.
Changed the folder name to "image_files" and reimport it to Xcode project as "folder". It works!
This is totally random...
That did it for me, too:
This happens to me when i switch from
testing on the device to testing on
simulator. Restarting Xcode and
simulator gets rid of this error for
me.Silly.
When a home directory mounted in NFS you have the problem with the simulator.
To get rid of it, you need to to create a couple of directories in some local place where you have permissions to write, "iPhone Simulator" and "Interface builder". Then remove "~/Library/Application Support/iPhone Simulator" and "~/Library/Application Support/Interface Builder 3.0". And finally create symlinks at the exact places of the removed directories pointing to the local directories.
For mine, I got the error when I tried to change the App bundle ID setting in my info.plist file for the sake of running a test. Changing it back cured the problem, but didn't do me any good for the test. Thankfully, the app had loaded in the simulator and I ran it manually for my test.
As far as I can tell, the problem stemmed from having a bundle ID that matched both a specific ID and a wild-card ID. The App IDs I've tried that match only a specific ID/Profile haven't shown a problem.
Check your console and you will get a better idea of what the error might be. That error number is pretty generic. In my case I had an error in my Plist file. I chenged something that I shouldn't have. But I realized this was the problem because the console had a more detailed error message:
2010-09-13 23:30:27.149 Appname[5580:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
... and it goes on.
I have had this problem frequently, and generally just quitting and restarting Xcode works.
However, I just had this problem again and nothing seemed to fix it - quitting the sim, Xcode, rebooting… What was strange was some targets worked (I have multiplied build targets for this project), and other projects worked. But one target failed to launch no matter what I did.
In the end, I found the problem: In the target's properties the executable name $[EXECUTABLE_NAME] got accidentally deleted ! Replace it, and it works.
Worth remembering…
I got same error. This is how i solved it. Hope this helps.
To show all hidden files type below from command line
$ defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder
Access DerivedData folder and delete it's content(under DerivedData). Basically this is Simulator Cache which sometimes does not get deleted from XCode. Library is a hidden folder
and that is why we run Step 1.
/Users/your username/Library/Developer/Xcode/DerivedData
Quit and re-open simulator , it will work i also got an issue like this and this helped me.
I am facing the exact same issue very frequently, what I do is
1) I quit the iphone simulator
2) and if after following step 1, if issue still the same, then reset the simulator
And it has resolved my issue all the time from step 1 itself.