Unable to run app in Simulator Xcode 6

2020-04-16 02:24发布

问题:

Yesterday i was testing my app in the iOS simulator and everything was working fine. I then decided to run the app on my iPhone and i got the error unable to install application, Unknown error occurred this has happened before so I cleaned my build folder (as this has fixed this issue before) however, the same error occurred. I then ran the app in the iOS simulator again and now i get the error Unable to run app in Simulator, An error was encountered while running (Domain = LaunchServicesError, Code = 0). I find this very weird as i didn't change anything besides trying to run the app on my iPhone. I have tried every solution given on this post and still no luck.

I'm sorry if my question doesn't contain much detail but as I said I didn't change anything and it was building and running fine a minute before plugging in my iPhone and trying to run it on there.

Any help would be much appreciated.

edit

I tried running other projects (with and without extensions) and they are working on both simulator and iPhone, therefore the problem must be within my project. (my project does have a today extension)

回答1:

In that kind of cases I usually :

  • Product > Clean
  • Close xCode
  • Delete the Derived Data (in ~/Library/Developer/Xcode/DerivedData subfolders)
  • Delete the app on the iPhone
  • Reboot the iPhone
  • Restart and rebuild


回答2:

I had this problem. In my case, it was caused by the Build value being blank. After putting a value there, and resetting the simulator once more, the issue went away.



回答3:

I had the same problem and checking the system log carefully helped me to identify a coliding library that was causing this error. You can also check this answer if you are using extensions.



回答4:

Generally it means there is a problem with the build, it may be due to old cache (solved by a clean build) or a project definition error (missing library, bad definition in info.plist, etc).

In my case it happened only on iOS 8, turns out that my widget had the wrong bundle ID.