Tuesday, July 24, 2012

Xcode - Could not launch app - No such file or directory Error.

This post will soon be moved to here
This blog has moved to http://dhilipsiva.com/blog/
This post is outdated.   

It has been 4 months since I have been developing for Apple (iOS). As a user, I am in love with Apple. But as a developer, I feel Apple is a crap. I mean, It treats developers like a piece of crap. I hate tools that apple provide for developers. Often buggy. I loved Microsoft from a developers perspective. Okie, to the subject now. I found this really annoying problem with Xcode and fixed it. When you run a project on Xcode, you sometimes end up with a message like this:

Could not launch app - No such file or directory

Thats really annoying. This error happens in a number of different situations. Sometime restarting the Xcode, fixes the problem. If not, follow these steps:
  1. Disconnect your device. 
  2. Delete the app from your device. 
  3. Quit xcode (Don't just simply close the window, quit it) 
  4. Delete derived data folder (~/Library/Developer/Xcode/DerivedData/-gbrvhlvwmpiobxdujegtghggrffp - or something like that) 
  5. Now start Xcode, connect device and run the project. It should work fine.
There it is.

EDIT: Weird. Even theses steps are not helping me sometimes. I dont know what is causing this problem. When everything else fails, restarting both Mac and iOS device solved the issue in some situation. And what is weirder? Some times the app just runs fine the next day, without me changing anything.  I know I am not practicing an elegant solution, but this is the only working solution I found so far. If you have any Ideas, you can mail me. I ll update this post as necessary. BTW, this is the post with most hits on my blog. 20,000 and counting! :)

46 comments:

  1. This worked wonderfully, thanks again!

    ReplyDelete
  2. I swear to god, when I become a bazillionaire I am gonna hire all you helpful blogger types! well done sir and thank you!

    ReplyDelete
  3. thanks for your pointer, but when building for armv6 the first time (with a recently created armv7 project), it may be that cause: http://stackoverflow.com/questions/11802547/armv6-and-armv7/

    ReplyDelete
    Replies
    1. Oh my god I love you. This was the answer to my problem. Every single answer I found online was wrong, except for this. I also was trying to test something on an older iOS device, and removing this from the plist file was the answer.

      Delete
  4. Yes this totally worked for me. THANK YOU!

    ReplyDelete
  5. Simply restarting worked for me, thanks

    ReplyDelete
  6. Still doesn't work for me. Any other workaround?

    ReplyDelete
    Replies
    1. Did you try mro's link in the above comments?
      http://stackoverflow.com/questions/11802547/armv6-and-armv7/

      Delete
  7. do you consider this an elegant solution ? there must be a reason, surely stupid one, why the Xcode is not able to find that file despite it's there in the right place ...

    ReplyDelete
    Replies
    1. Never said this was an elegant solution. Just blogging whatever worked for me. And from the previous comments, I can see that it worked for many of the others too. :) ;)

      Delete

  8. Que grande eres
    <\spanish>

    Thanks, the protect works again. You are a big boy...

    ReplyDelete
  9. It worked perfectly, thank you for your help!

    ReplyDelete
  10. This is Mike from Germany and I want to thank you for this fast solution.
    Vielen Lieben Dank.

    Greetz Mike

    ReplyDelete
  11. Thankyou from Electric Pocket too!

    ReplyDelete
  12. Totally worked for me, thanks for sharing!

    ReplyDelete
  13. thanks for the fix!!!!

    totally agree about apple treating devs like crap.

    ReplyDelete
  14. Bullshit its working now... thanks buddy..

    ReplyDelete
  15. If you're fixing to update apps that have previously been launched in the Apple Store, you could get all that non-sense. This has been my case. I do agree that XCode should do a better job of dealing with situations like this. Have you been faced with the challenge of dealing with source code that has been deprecated in iOS 6 yet?

    ReplyDelete
    Replies
    1. Yes, I did face that situation. And I fixed it. :)

      Delete
  16. this is great - was so annoyed for a while... thank you for sharing!

    ReplyDelete
  17. for xcode 4.5 all steps work but step 3 wasn't needed for me. after step 4 I received a message that file could not be found. no app icon installed on device. ran project again and all is working perfect.

    ReplyDelete
  18. it solved my problem in a project which is newly build but a same problem occur if i used to build a code that has developed on xCode3 but now i am using xCOde 4.5.1 and it gives that error

    ReplyDelete
  19. The error was coming from the fact that I played with the "Devices" option, changing from Universal to Phone, and XCode automatically changed the option "Deployment Target" to 6.0. I was not trying to run on an 6.0 device, hence the error.

    ReplyDelete
  20. Didn't find the "~/Library/Developer/Xcode ... "
    but, once I quite Xcode - then restarted ( without discontenting my iPhone ) it worked perfect.

    You're AWESOME!!!!!!!!

    Thank you

    ReplyDelete
  21. Thank you very much!

    ReplyDelete
  22. Thanks, saved a lot of time!

    -Tried to update XCode via the AppStore.
    Didn't work, had to delete XCode from Applications.
    -Freshly installed XCode
    -Created a new project
    -Got the "Could not launch app - No such file or directory Error"

    Following your solution, the problems were gone.

    ReplyDelete
  23. Deleting folder helped: ~/Library/Developer/Xcode/DerivedData/-gbrvhlvwmpiobxdujegtghggrffp

    ReplyDelete
  24. Thanks bro this same me from a severe headache

    ReplyDelete
  25. Thats awesome!!! Thanku!!!

    ReplyDelete
  26. Thanks man. I have not read all the comments but I wonder what causes this. I think it happened for me when fiddling about with the signing certificates.

    ReplyDelete
  27. I was dubious it would work because it seemed so far fetched, but it did work perfectly. Thank you very much!

    ReplyDelete
  28. readings were really very good. I will bookmark this blog so that I could often visit this blog often to read the latest article from your blog. behind terimaksih awaited visit, .......


    ios development jakarta | firzil.co.id

    ReplyDelete