Unable to run app in Simulator: An error was encountered while running (Domain = LaunchServicesError, Code = 0)
Asked Answered
K

25

95

After successfully compiling the project in Xcode 6, I am unable to run it in the simulator with the above mentioned message. I did all the possible research, tried everything and still no advances.

I am not working with swift, neither I use widgets or extensions, so please do not suggest solutions caused by these as can be seen in similar questions.

If someone found a possible cause (or solution!!) other than these, please help. Thanks

Kishakishinev answered 17/9, 2014 at 11:21 Comment(5)
it would be helpful if you can list what you have tried to exclude those recommendations.Perichondrium
The issue is now resolved, but just for information I tried: - running a clean - removing the project cache/derived data - restarting both Simulator and Xcode - restarting the Mac - reinstalling Xcode - cleaning and reinstalling CocoaPods - checking Build Settings for any rare appearances Nothing helped. Did't try fiddling with app extensions naming as I do not use any.Kishakishinev
"Product -> Clean" worked for me.Hairbreadth
I had this problem: #27038089Bifoliolate
Restarting simulator solved my problemCorneliacornelian
K
28

This has now been resolved. The problem was caused by ShareKit library added by CocoaPods for compatibility reasons. After removing the library and all related code, the app successfully launched in simulator. I recommend checking the system log for more details on the issue as to me it pointed me in the right direction (stating the name of conflicting library).

Kishakishinev answered 17/9, 2014 at 15:30 Comment(7)
I just added shareKit and I have the same problem.Ironist
In case this helps anyone: You can access the system log by typing Console in Spotlight.Selenite
For me it was the MixpanelAppExtensionMelissamelisse
Thanks, this helped me out. XCode 7.3.1 and my log showed "ErrorDescription=Could not hardlink copy". I was setting a version but not build number in Target -> General -> Identity. Once I included a value for Build the problem went away.Geneticist
To check system log try this command in Terminal: tail -f /var/log/system.logiOS Simulator prints directly to stdout, so you can see the logs mixed up with system logs.Andromache
ShareKit was not my issue, but the recommendation to check the console log helped me track down the actual issue, which in my case was a bad bundle ID.Messroom
Myframework.framework did not have a CFBundleIdentifier in its Info.plist but everywhere the key is presentAirlift
D
179

"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.

Reset Content and Settings

Discretionary answered 19/12, 2014 at 11:4 Comment(5)
Way better than initial answer. Should be marked as the solution.Aftershaft
After that I also needed to quit and reopen the simulator.Eluvium
This requirement is already mentioned in my answer @jfredsilva.Discretionary
Also deleting the App if you had previously installed it on the simulatorPrestissimo
Worked for me after also deleting Derived DataBrownley
G
126

Cleaning the build folder resolved the issue for me.

(While holding down the Alt-key: Product > Clean build folder)

Glycerin answered 1/7, 2015 at 7:52 Comment(3)
This worked for me after I updated to use Cocoapods and the .xcworkspace.Tidwell
This is a must-do after updating to Cocoapods v1.0.0Galvanoscope
Best answer so far, tried everything from resetting app + cleaning xcode to deleting and reinstalling all the pods, nothing worked until i found this.Emboly
P
33

I tried every other solution listed here. Well, I ported my project from Swift 1.2 to Swift 2.0. The application was stuck even after a lot debugging and launch services error 0 was reported.

solution: It happens because of framework compilation.

App target -> Build Phases -> Embed Frameworks.

So mark copy only when installing on. Clean the project and run it!

enter image description here

Prospect answered 19/11, 2015 at 5:14 Comment(3)
Can you explain more about how "Copy only when installing" fixes the problem?Cushat
@ sethfri : "Copy only when installing" to specify that the build phase copies files only in install builds of the product. developer.apple.com/library/mac/recipes/…Prospect
I understand what the words "Copy only when installing" mean. I'm asking how this fixes the problem the question author is facing.Cushat
K
28

This has now been resolved. The problem was caused by ShareKit library added by CocoaPods for compatibility reasons. After removing the library and all related code, the app successfully launched in simulator. I recommend checking the system log for more details on the issue as to me it pointed me in the right direction (stating the name of conflicting library).

Kishakishinev answered 17/9, 2014 at 15:30 Comment(7)
I just added shareKit and I have the same problem.Ironist
In case this helps anyone: You can access the system log by typing Console in Spotlight.Selenite
For me it was the MixpanelAppExtensionMelissamelisse
Thanks, this helped me out. XCode 7.3.1 and my log showed "ErrorDescription=Could not hardlink copy". I was setting a version but not build number in Target -> General -> Identity. Once I included a value for Build the problem went away.Geneticist
To check system log try this command in Terminal: tail -f /var/log/system.logiOS Simulator prints directly to stdout, so you can see the logs mixed up with system logs.Andromache
ShareKit was not my issue, but the recommendation to check the console log helped me track down the actual issue, which in my case was a bad bundle ID.Messroom
Myframework.framework did not have a CFBundleIdentifier in its Info.plist but everywhere the key is presentAirlift
O
16

In case anyone has this problem in combination with cocoa pods, these steps helped me to solve this error (after few hours):

  • run pod cache clean
  • from SRC_ROOT run rm -rf Pods (optionally rm Podfile.lock)
  • Click on the Simulator app, click Simulator -> Reset Content and Settings...
  • Go into Xcode, In the Menu bar click Product -> Clean (or click Shift + Command + K).This will to clean your Xcode project.
  • Create a new Terminal Shell (From menu bar click Shell -> New Window)
  • run rm -rf ~/Library/Developer/Xcode/DerivedData/

...then try to Build & Run your project.

Note: SRC_ROOT can be found by entering the Navigator, clicking on the project, clicking on the project again from the project and targets list, going into Build Settings, scrolling all the way to the bottom to the User-Defined Section, and the SRC_ROOT will be labeled as PODS_ROOT. Take that and copy it verbatum into the Terminal and proceed with step 2 from the list above.

Hope it helps.

Olivann answered 20/8, 2016 at 2:49 Comment(2)
This did it. Thank you! Really should be the accepted answer.Lobbyism
That solved my issue! Definitely it should be the accepted answer!Emulous
P
15

I get rid from the issue by the given steps for simulator

1. Way

  1. Reset Content and Settings of Simulator.
  2. Clean your project by Cmd+Shift+K.
  3. Clear your Derived Data.
  4. The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname" like "com.facebook.Facebook"

2. Way

You can do only be the given line, it works for me

The last one which is more important change your Bundle Identifier by "com.yourcompanyname.projectname" like "com.facebook.Facebook"

Thanks and enjoy programming.

Peter answered 25/11, 2015 at 13:28 Comment(3)
Do you mean cmd instead of win? ;) (Or maybe you use a windows keyboard.)Foppery
@JeroenJK Yes its Cmd.Peter
Wow, the bundle ID change is the one that finally worked for me. Thanks!Homovec
J
6

Might be related to this issue: "This app contains an app extension with an illegal bundle identifier" issue

I had to format the bundle identifiers for my app and extension as follows:

com.company.AppName
com.company.AppName.Extension
Jurisdiction answered 1/12, 2015 at 9:48 Comment(2)
Same here. I changed the bundle identifier because the extension(widget) was not showing up, and that caused it. Had to lower the extension version from 9.2 to 8.2 and change the bundle as mentioned above.Spadiceous
Thanks, exactly my problem!Denominationalism
P
6
  1. First "Reset Content and Settings"
  2. If you didn't fill the build number and fill it and Run.

It's solved for me.

Plaque answered 17/2, 2016 at 15:44 Comment(0)
S
4

If you change the name of the supplied class InterfaceController set by default when you start a new project. This class is referenced in the Info.plist under the key RemoteInterfacePrincipalClass. In my case, I got the error mentioned by the OP until I fixed the name of the class in there (see screenshot).

Info.plist: set principal class

Sulfathiazole answered 25/3, 2015 at 15:33 Comment(0)
E
2

Thanks for pointing this out @Miki and kudos to you. I had the same issue as you yesterday (and I added ShareKit 3.0.0 from CocoaPods to the app a few days ago). I suspected ShareKit giving me this problem, but now I can be confident of exactly which library is causing this. Here is what I found in my log (if it can benefit others):

Error Domain=LaunchServicesError Code=0 "The operation couldn’t be completed. (LaunchServicesError error 0.)" UserInfo=0x7fa836097aa0 {Error=PackageInspectionFailed, ErrorDescription=Failed to load Info.plist from bundle at path /Users/{UserName}/Library/Developer/CoreSimulator/Devices/99FEB34E-6F00-4EFA-861A-A6985AFE96D8/data/Library/Caches/com.apple.mobile.installd.staging/temp.X7eead/extracted/{AppName}.app/Frameworks/LiveSDK.framework}

Etude answered 18/9, 2014 at 9:27 Comment(2)
from your log, how can you know that ShareKit causes the error?Yawl
i have the same thing in my log but removing simulators and adding them back doesn't help... how did you fix the error?Holofernes
M
2

If you are here after having issues doing an integration with WatchOS 2.0, go to - ~/Library/Logs/CoreSimulator/[Device UDID]/system.log and if says something like WatchKit 2 app has frameworks; that's not allowed. then follow the link below.

http://zyafa.me/blog/watchos-2-and-embedded-frameworks

Menell answered 22/9, 2015 at 14:41 Comment(2)
Thanks for pointing me to the simulator log file. In my case the log file at ~/Library/Logs/CoreSimulator/CoreSimulator.log disclosed that my linked framework did not have a CFBundleIdentifier in its Info.plistSkijoring
framework did not have a CFBundleIdentifier in its Info.plist : i'm also getting this what is the solution? not using on watchkit or watchOSAirlift
A
1

I'm adMob user and I solved enabling "Copy only when installing" in App target -> Build Phases -> Embed Frameworks.

Ami answered 20/10, 2015 at 17:33 Comment(0)
F
1

Have the same problem after localizing my app. Especially Info.plist. Seems I had empty CFBundleShortVersionString in InfoPlist.strings, after fixing that the simulator started to work properly.

Feud answered 21/12, 2015 at 10:50 Comment(1)
That was my problem too. If you see that try to remove all keys that not requires localisation from your InfoPlist.strings files. In my case removing keys below fixed everything: CFBundleName CFBundleShortVersionString CFBundleVersionSpud
M
1

I got this issue by adding a folder reference named "Resources".

If I give it another name, then it runs !

Musjid answered 7/5, 2016 at 14:45 Comment(2)
This one solved me a similar issue! I was embedding a dylib, and it caused a cryptic "did not have a CFBundleIdentifier in its Info.plist" installation error. After changing the Resources folder to something else it started working againOglesby
Two birds with one stone ;)Musjid
M
1

There are a number of things that can cause this error. The best general answer is to search the console log for CoreSimulator, as the simulator logs the underlying problem when it displays this message.

Messroom answered 23/6, 2016 at 22:31 Comment(0)
W
1

If you have installed any libraries using CocoaPods while XCode was open, all you have to do is, Close XCode and remove the library from Pod file, run the command pod install it will uninstall that library. then install library again. Please make sure that XCode is always closed while installing and uninstalling libraries.

Whensoever answered 11/8, 2016 at 5:45 Comment(0)
A
0

I hade exactly the same problem and it was ShareKit.

On the simulator I had "Error Domain=LaunchServicesError Code=0".

On the iPhone6 device I had "App installation failed Could not inspect the application package."

When I removed ShareKit it worked.

Adige answered 24/9, 2014 at 13:5 Comment(0)
F
0

I had this problem when I added an Apple Watch target to my app, and accidentally removed the InterfaceController.m file. Adding back the file in the target fixed the problem.

Fruitage answered 24/3, 2015 at 22:57 Comment(0)
B
0

There are different things that can cause this. Looking in the console may well give you a clue.

In my case - the issue was an extension built before I changed the name of the product. Xcode didn't clear the old one out, then got stressed at two extensions with the same bundle id.

(Deleting the build folder fixed my particular issue).

Bloodless answered 8/4, 2015 at 19:20 Comment(0)
B
0

In my case the issue came from an icon set added with some images missing. Once I replaced the icon set with another one, and uninstalled the app in the simulator; I was able to run it again.

Bosky answered 17/9, 2015 at 9:33 Comment(0)
L
0

I removed all my pod files and replaced them all, seems the problem for me was the bolts framework was old, and causing this error. I did a clean & reset content and now it's all good.

Legalize answered 5/10, 2015 at 19:35 Comment(0)
L
0

Do not add the google maps framework to the embedded lib section this solved my build break.

Linders answered 2/11, 2015 at 1:7 Comment(1)
Removing the embedded framework that wasn't necessary to be there fixed my issue alsoCounterstamp
G
0

I had this error in developing app for Apple Watch after adding in Info.plist: "App Transport Security Settings" and "Allow Arbitry Loads" = YES. (In WatchKit App, in WatchKit Extension is good!!) Deleting this two rows, it keeps working.

enter image description here

Gymkhana answered 28/4, 2016 at 12:45 Comment(0)
R
0

For me, the problem occurs because I added my framework (GoogleMobileAds.framework in my case) to Embedded Binaries, not Linked Frameworks and Libraries.

For your information, AdMob instructs you to use Add Files to "Your Project" menu on Xcode, but I was too lazy to obey the instruction.

Rhinestone answered 24/5, 2016 at 8:2 Comment(0)
D
0

I had this problem when trying to run UI tests in a project containing AWS Cognito.

Here's how I resolved it.

  1. Select the UI test target.
  2. Click on the Build Phases section.
  3. Click the plus to add a Copy Files phase Add Copy Files phase
  4. In the Copy Files phase, change the destination to Frameworks (see the last image)
  5. Hit the plus below the Copy Files phase.
  6. Select the framework for which you're receiving an error and hit the Add button (yours will probably not be the first item in your project hierarchy). Select Framework to copy It should end up looking like this. Final Result
  7. Repeat steps 5 and 6 for all frameworks giving you an error.
  8. Run your tests.
Disapproval answered 11/7, 2016 at 22:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.