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

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

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

Cleaning the build folder resolved the issue for me.
(While holding down the Alt-key: Product > Clean build folder)

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!

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).

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.

I get rid from the issue by the given steps for simulator
1. Way
Reset Content and Settings of Simulator.
Clean your project by Cmd+Shift+K.
Clear your Derived Data.
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.

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

First "Reset Content and Settings"
If you didn't fill the build number and fill it and Run.
It's solved for me.

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).

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

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}

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

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.

I got this issue by adding a folder reference named "Resources".
If I give it another name, then it runs !

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.

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.

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.

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.

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).

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.

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.

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

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.

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.

I had this problem when trying to run UI tests in a project containing AWS Cognito.
Here's how I resolved it.
Select the UI test target.
Click on the Build Phases section.
Click the plus to add a Copy Files phase
In the Copy Files phase, change the destination to Frameworks (see the last image)
Hit the plus below the Copy Files phase.
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).
It should end up looking like this.
Repeat steps 5 and 6 for all frameworks giving you an error.
Run your tests.

Related

Unable to install app in simulator Xcode 9 beta

I downloaded Xcode 9 beta recently, and when I tried to run my app in the simulator it is not getting installed. I am getting this error in my Xcode every time I try to run the app.
This app was unable to be installed.
The application used to work in Xcode 8.3.3
Unfortunately, the error message doesn’t explain why the install failed. You can take a look at ~/Library/Logs/CoreSimulator/CoreSimulator.log to see if the rest of the error message is there with more info. If not, you should check out the sim device’s system log:
sudo xcode-select -s /Applications/Xcode-beta.app # if you haven’t already
xcrun simctl spawn booted log show
You can use --predicate to filter that down a bit.
Late answer but might be that can be useful for others. I just get a project with existing watch-kit and custom keyboard code. After change the identifier i got the same error and i spend 1 day to find out why that happens.
I checked everything of bundle id and all version. then i do global search in xcode with old identifier and i found that following.
Here in both .plist file have old WKCompanionAppBundleIdentifier so after i update it with new manually application run again.
IMPORTANT NOTE:
IF YOU ARE JUST CHANGE IDENTIFIER FROM GENERAL TAB THAT DOES NOT MEAN IT UPDATE AT ALL. KINDLY CHECK WITH ALL POSSIBLE PLACES BY SEARCH AND REPLACE IT WITH NEW IDENTIFIER.
XCODE VERSIO: Version 9.0 (9A235)
I ran into this same issue and a quick click on Product > Clean did the trick for me!
If you are using CocoaPods in your project please have a look at this answer: https://stackoverflow.com/a/44533287/221194
Changing the status of the pods subdirectory helped me with my project.
I had a similar issue when installing my App on the IOS simulator (with Xcode 9).
I found the issue (at least for my case), it was due to an unauthorized key (Privacy - Location When In Use Usage Description) in the info.plist of the Watch App.
I have moved this key to the info.plist of the WatchKit Extension and now the App installs again.
I hope it will help others people having the same issue.
change deployment target as per requirement.
select project > GENERAL > DEPLOYMENT TARGET
also check ios version of your device
I had the same issue. Log shows it's an error caused by Google Signin:
FunctionName=-[MobileInstallationHelperService stageItemAtURL:completion:], SourceFileLine=392, NSUnderlyingError=0x7f891e9a1270 {Error Domain=MIInstallerErrorDomain Code=4 "Failed to remove ACL" UserInfo={NSLocalizedDescription=Failed to remove ACL, FunctionName=-[MIFileManager _removeACLAtPath:isDir:error:]
However it works on iOS 9 & 10 simulator.
I got same error and I was using Cocoapods in my project and for me help just update pods.
I ran into this issue in Xcode 9.0 beta 5 after renaming a project that contained an iOS and watchOS app. To fix, I recreated the iOS target.
This issue could be triggered by multiple things however if you take a look at the logs at ~/Library/Logs/CoreSimulator/CoreSimulator.log and it states an error that reads :
NSUnderlyingError=0x7fb51c271ee0 Could not hardlink copy /originPath
to /destinationPath
it's possible that your Build number in your Project Target's settings is set to empty.
Go to Project Target > Identity > Build and set a Build number. You'll have to uninstall the the app in the simulator and re-install it before installing updated versions.
Please check the bundle identifier to solve the issue.
I had the same issue on XCode 9.3.1 when I wanted to add google map framework to my project manually.
To fix the problem I remove the google frameworks from Embedded binaries...

iOS app testing. App installation failed. No code signature found [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I've tried to install my app on several iOS devices. But this thing didn't let me to.
I want to know, what the problem is and how should I solve it.
In my case, the problem was unsigned frameworks.
Xcode 11 or above:
Go to Build Phases, expand Embedded Frameworks and select all Code Sign on Copy checkboxes.
Xcode 10 or earlier:
Build Phases > Copy Files > Code Sign on Copy (select all checkboxes)
I had this problem, this is what I did to resolve it:
Run "clean" in Xcode
Close Xcode
Remove all data in ~/Library/Developer/Xcode/DerivedData
Remove all xcuserdata folders in your project (check in your xcodeproj and project.xcworkspace directories)
Only if you have Cocoapods in your project:
Run pod deintegrate.
Remove your .xcworkspace if it was created by CocoaPods.
Run pod install or pod update
Now you can open your fresh Xcode.
Hope this help you.
In my case the problem was created by adding a new cocoa touch framework.
If "code sign on copy" fails, then check if you are modifying the frameworks in a run script after the "Embed Frameworks" phase.
If you are, then move the Run script to a position before the "Embed Frameworks" phase.
In my case, I have created an unsigned IPA file and for this i had made some changes in SDKSetting.plist file (changed CODE_SIGNING_REQUIRED = NO) and it should be always YES if you are running application on the device.
To resolve this follow the below steps:
Steps to create unsigned IPA (Tested on Xcode 9.4.1)
Step 1: Open finder > Go to Folder.. as below screen
and then copy and past the below line:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.*.sdk/SDKSettings.plist
Open iPhoneOS.sdk as showing in below image:
Step 2:
Copy the SDKSettings plist in another folder because you can't make changes here:
Step 3: Make the change in duplicate
set CODE_SIGNING_REQUIRED to YES
Step 4: Now replace duplicate Plist with the original one (Both names must be the same).
This will also ask admin permission to change.
********************************OR**************************************
If you will update your Xcode then the problem will also disappear because updated xcode will come with default SDKSetting.plist
I also faced same issue.
I tried all above solution none work from me.
Below stuff worked for me,
Select Build settings
Locate "Code Signing identity"
select "IOS Developer" or any other correct option for all.
Then build and run.
Folks, My problem's Root cause was modifications that were done by iOSOpenDev installer. I did restore the original plist file that was backed up by the installer. that solved my problem
you need to look into the SDK directory to see if something funky has happened.
at least one more option to try.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<SDK version>.sdk/
example:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/
by default code signing must be turned on, if that is turned off then something funky happened. (for ref See Alok's answer below)
If nothing works. My recommendation would be to delete and reinstall Xcode as this error would not arise in the normal scenarios. So resetting Xcode can greatly reduce troubleshooting time.
1) Try to clean project
2) Try to relaunch XCode
3) Reset your mac
I have some issues during App upload to the Appstore then i Add Some Code
in Build Phase -> Run Script
done
I clean Build folder and remove t above code from Run Script
And Build again and run on my Iphone it work fine
You can remove the code of run script or
check the check box of ."Run script only when installing " then also it will work
Enabling "Automatically manage signing" solved the issue for me. (In the target settings, "General" tab, section "Signing")
Restarting my device fixed the problem
It is clear you do not have the developer and the distribution profile set for the devices you are trying to install the app.

Simulator fails with (LaunchServicesError error 0.) [duplicate]

This question already has answers here:
Unable to run app in Simulator : An error was encountered while running (Domain = LaunchServicesError, Code = 0)
(19 answers)
Closed 5 years ago.
I received an error (Domain = LaunchServicesError, Code = 0) when trying to launch my app in the iOS Simulator with Xcode 6. I looked for solution in google, but I didn't find anything practical.
What does this error mean?
This error indicates that there was a problem with installation. Unfortunately, Xcode does not actually print the contents of the error message that would give you more insight, but you can look at ~/Library/Logs/CoreSimulator/CoreSimulator.log to see the rest of the error details. There will also be more information about the problem in the simulated device's system log (~/Library/Logs/CoreSimulator/[Device UDID]/system.log); look for messages from installd around the time of the error).
Common causes for this include bundles missing an Info.plist, missing keys within your bundle's Info.plist, or values for some keys in the Info.plist not being allowed.
If your app's Info.plist does not contain a valid CFBundleVersion key/value pair, it is possible that your app may install correctly the first time but fail to update. Many users seem to work around this by doing a "Reset Contents & Settings" after each install, but it would be better to fix the root cause by setting an appropriate CFBundleVersion in the Info.plist. I believe iOS 8.2 now correctly returns an error on the first install in this case rather than just on updates, so hopefully this problem will be more obvious now.
Users with home directories on file systems that do not support hard links (eg: network home directories via AFP, SMB, or some NFS servers) may also run into problems related to hard linking. If this is the case, I suggest you create a path on your local HFS+ filesystem for simulator development (eg: /var/simulator/[user]) and create a symlink to that path from ~/Library/Developer/CoreSimulator. This particular issue was fixed in one of the iOS 8.2 betas.
In another case, the Build&Run would always succeed on the first try, but subsequent attempts would sometimes fail due to a changed Info.plist (eg: because someone's build system settings result in CFBundleVersion being different on each iteration). You can usually recover by either deleting the installed app (using a long-press from the home screen or xcrun simctl uninstall [Device UDID] [app identifier]) or erasing the device back to a default state. To erase the device, execute xcrun simctl erase [Device UDID] from terminal or choose Erase Contents & Settings from the iOS Simulator menu. This particular issue was fixed in one of the iOS 8.2 betas.
A newer instance of this issue is occurring for Xcode 6.2 users. If you have a WatchKit App Extension bundled in your app, it will fail to install to versions of the iOS Simulator runtime older than iOS 8.2. As a workaround, you will need to manually disable the app extension from installing when you want to test with iOS 8.1 and earlier runtimes.
If you need more specific help, please provide the entirety of the error message from CoreSimulator.log and any messages from installd and CoreSimulatorBridge that appear around the same time in ~/Library/Logs/CoreSimulator/[Device UDID]/system.log as that will reveal the underlying problem.
Does your project include a widget or extension? If so, the problem could be the bundle identifier of your widget/extension. It should be the same as the main target, appended with a period and an extra string. So for example:
Main target: com.mycompany.myapp
Widget should be: com.mycompany.myapp.widget
I fixed it by resetting the simulator:
iOS Simulator > Reset Contents and Settings...
Since everyone writes what they went through and how they fixed their exact problem, that might be unhelpful.
The problem is that there are different causes for the same error message and the right way of solving it is to open up ~/Library/Logs/CoreSimulator/CoreSimulator.log and look in there for the last message. This message gives you a good clue and sets you on the right path of solving your problem (sometimes it's bundle IDs, sometimes it's a missing or an extra attribute in the Info.plist, but you always get a good, descriptive clue).
This is how you narrow down the problem and eventually get to fix it.
Good luck and tough nerves with Xcode .)
Z.
For me I just cleaned the project and it worked -> Product -> Clean
TLDR: Clear your Project Build Folder - and you will be free of this pain.
( plus I logged this as a bug with Apple as they need to find a way to fix this in Xcode )
None of these solutions worked for me - I banged my head against several walls.
I looked at the CoreSimulator log and I realised that it was trying to build a library that I had deleted.
I couldn't find references to it anywhere.
Then I saw via another SO Question which unfortunately I can't find to reference, if you:
Hold down your option key then Product-> Clean option becomes Clean
Build Folder
Press that and enjoy having your error vanish
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
In XCode 6
An error was encountered while running (Domain = LaunchServicesError,
Code = 0)
I had this error after making some major code changes to accommodate the iPhone 6 Screens. in Xcode 6 (iOS8)
I followed the options above and found that the only way to really get this fixed was by doing the following:
Deleted the derived data [go to Window >> Organizer >> (Find your App) Click on Delete next to the Derived Data]
Product >> Clean
Reset Contents and Settings in Simulator
Changed the Bundle Version to 1.4.1 from 1.4 in pList
Thank you for all the previous answers that got me to this stage. It worked a charm!
In my case, the error was caused because i didn't set the build id.
Setting this, launches the emulator without problem.
One other thing to try, that worked for me, after resetting the simulator and doing a clean build did not help, is clearing out the derived data. To do this: go to Organizer click on project click on delete derived data button. I had this happen after working on an extension for a while and went back to the regular branch. Hope this helps.
This is what caused the problem for me: the build number for the main app and the extension were different (I had incremented the main app build number to 1.0.1.03, but left the extension at 1.0.1.02).
Making them match fixed the problem for me.
Open the Console app and look there. In my case it told me exactly what to do. I saw:
ErrorDescription=WatchKit 2 app extension's NSExtension.NSExtensionAttributes.WKAppBundleIdentifier value does not match WatchKit app's bundle ID (found "com.myCompany.MyApp.MyApp.watchkitapp"; expected "com.myCompany.MyApp.watchkitapp").
So, I went to each plist and checked any items that related to a BundleID. Then Clean, relaunch, etc.
My case was about framework compilation. I have enabled the 'copy only when installing' option from Target- Build Phases- Embedded Frameworks-
I have an app that is set up to use different bundle IDs based on the build configuration. When creating my Apple Watch extension, Xcode generated everything using my Release ID, so I had to go through and change it all manually for debugging. Here's all the places I had to change it:
WatchKit Extension's Build Settings -> Packaging -> Product Bundle Identifier
WatchKit Extension's Info.plist -> NSExtension -> NSExtensionAttributes -> WKAppBundleIdentifier (this needs to use the same prefix as your companion app)
WatchKit App's Info.plist -> WKCompanionAppBundleIdentifier
The last one took me a while since the WatchKit App's Info doesn't show up as a tab when viewing the target settings, I had to go direct to the Info.plist file itself.
Try putting some number into [TARGETS]-[General]-[Identity]-[Version(or Build)], if they are empty.
It worked for me.
I hope it will help you.
I also have this error. In my case the log ~/Library/Logs/CoreSimulator/CoreSimulator.log was something like that :
Could not hardlink copy /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Containers/Bundle/Application/70F24DDC-7954-46BF-B799-F807FD98yyyy/myApp.app to /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/Payload/myApp.app with manifest /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/com.apple.deltainstallcommands.com.mycompagny.myapp
thanks to this answer In look at my app info.plist. the key CFBundleVersion was missing so I add it and now everything is working !
None of the above worked for me, but this did:
I simply deleted IceCream.xcworkspace/xcuserdata/xcuserdatad and then reset the simulator and ran the app again. (Reseting the simulator alone, did not work for me.)
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
The great explanation by Jeremy at least set me in the right direction, but despite having all the bundle identifiers and versions set correctly, the error still persisted. I then checked the Apple documentation which shows that the WatchKit extension (in its Copy Bundle Resources phase) copies the WatchKit app. This WatchKit app was named exactly the same as my iOS app, causing Xcode to confuse the two and read out the wrong plist, thinking the bundle identifier was incorrect. Renaming the Product of the WatchKit app to something distinct finally solved it for me.
If you've changed your bundle ID, make sure you do a clean build before trying to build it again! See how here: How to Empty Caches and Clean All Targets Xcode 4
So it's definitelly .plist problem. In my case it was empty NSExtensionMainStoryboard, removing this property fixed the problem
I had this error whilst trying to build Apple's Lister Xcode Project and run it on the simulator.
The essentials which fixed it for me were:
1) BundleID for the iOS App and the iOS Extension had to be different
2) I provide iCloud and App Groups for both targets
3) I used Xcode's "Fix Issue" to fix the issues
After that I could build and run the app without warnings or errors.
The clue from the log file was "... LegacyErrorString=DuplicateIdentifier, FunctionName=-[MIInstallableBundle performPreflightWithError:], SourceFileLine=450, NSLocalizedDescription=The parent bundle has the same identifier (com.ACMECompany.Lister) as sub-bundle at /Users/stephen/Library/Developer/CoreSimulator/Devices/5329928B-946B-40A4-B666-EFD11B96D11F/data/Library/Caches/com.apple.mobile.installd.staging/temp.HQ5d9X/extracted/Lister.app/PlugIns/Lister.appex"
Had a wrong app version set in InfoPlist.strings localization file. Urgh!
An hour gone!
Delete your simulator and regenerate one.
It works for me.
I removed the key in watch app's .plist file that shouldn't have been there. And the problem disappeared.
This worked for me:
In project settings -> General tab -> Identity section I changed the Version number from something like 2.0.2 (three digits) to 2.0 (two digits) then I deleted the app in the simulator and run the project again. No more error after that.
One other possible solution to add to all of the others that will no doubt stay above mine ;)
I deleted & later reinstated a Today Extension target retaining the source files, but after trying every solution under the sun, I realised it didn't have any sources or resources in its target! You might encounter this as well if your detailed launch services error can't find your compiled app extension file.
So, long story short, make sure your target has something included to compile or bundle in there. You can check your target memberships by selecting the relevant file(s) on your project navigator (on the left) and setting your checkmark(s) as appropriate in the file inspector (that's the first tab on the right).
I had the following in my log...
<Error>: Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=ExecutableTwiddleFailed...
This was due to there being no source files added in the extension project.
This error was showing up on my system when there was no hard disk space available. I freed up some space on my system for it to work.
My Problem was that the wrapper extension for the target project was unset.
To fix I had to go to target project -> build settings -> Packaging -> Wrapper Extension.
Set this to "app" (No quotes)
This fixed the problem for me

An error was encountered while running (Domain = LaunchServicesError, Code = 0) [duplicate]

This question already has answers here:
Unable to run app in Simulator : An error was encountered while running (Domain = LaunchServicesError, Code = 0)
(19 answers)
Closed 5 years ago.
I received an error (Domain = LaunchServicesError, Code = 0) when trying to launch my app in the iOS Simulator with Xcode 6. I looked for solution in google, but I didn't find anything practical.
What does this error mean?
This error indicates that there was a problem with installation. Unfortunately, Xcode does not actually print the contents of the error message that would give you more insight, but you can look at ~/Library/Logs/CoreSimulator/CoreSimulator.log to see the rest of the error details. There will also be more information about the problem in the simulated device's system log (~/Library/Logs/CoreSimulator/[Device UDID]/system.log); look for messages from installd around the time of the error).
Common causes for this include bundles missing an Info.plist, missing keys within your bundle's Info.plist, or values for some keys in the Info.plist not being allowed.
If your app's Info.plist does not contain a valid CFBundleVersion key/value pair, it is possible that your app may install correctly the first time but fail to update. Many users seem to work around this by doing a "Reset Contents & Settings" after each install, but it would be better to fix the root cause by setting an appropriate CFBundleVersion in the Info.plist. I believe iOS 8.2 now correctly returns an error on the first install in this case rather than just on updates, so hopefully this problem will be more obvious now.
Users with home directories on file systems that do not support hard links (eg: network home directories via AFP, SMB, or some NFS servers) may also run into problems related to hard linking. If this is the case, I suggest you create a path on your local HFS+ filesystem for simulator development (eg: /var/simulator/[user]) and create a symlink to that path from ~/Library/Developer/CoreSimulator. This particular issue was fixed in one of the iOS 8.2 betas.
In another case, the Build&Run would always succeed on the first try, but subsequent attempts would sometimes fail due to a changed Info.plist (eg: because someone's build system settings result in CFBundleVersion being different on each iteration). You can usually recover by either deleting the installed app (using a long-press from the home screen or xcrun simctl uninstall [Device UDID] [app identifier]) or erasing the device back to a default state. To erase the device, execute xcrun simctl erase [Device UDID] from terminal or choose Erase Contents & Settings from the iOS Simulator menu. This particular issue was fixed in one of the iOS 8.2 betas.
A newer instance of this issue is occurring for Xcode 6.2 users. If you have a WatchKit App Extension bundled in your app, it will fail to install to versions of the iOS Simulator runtime older than iOS 8.2. As a workaround, you will need to manually disable the app extension from installing when you want to test with iOS 8.1 and earlier runtimes.
If you need more specific help, please provide the entirety of the error message from CoreSimulator.log and any messages from installd and CoreSimulatorBridge that appear around the same time in ~/Library/Logs/CoreSimulator/[Device UDID]/system.log as that will reveal the underlying problem.
Does your project include a widget or extension? If so, the problem could be the bundle identifier of your widget/extension. It should be the same as the main target, appended with a period and an extra string. So for example:
Main target: com.mycompany.myapp
Widget should be: com.mycompany.myapp.widget
I fixed it by resetting the simulator:
iOS Simulator > Reset Contents and Settings...
Since everyone writes what they went through and how they fixed their exact problem, that might be unhelpful.
The problem is that there are different causes for the same error message and the right way of solving it is to open up ~/Library/Logs/CoreSimulator/CoreSimulator.log and look in there for the last message. This message gives you a good clue and sets you on the right path of solving your problem (sometimes it's bundle IDs, sometimes it's a missing or an extra attribute in the Info.plist, but you always get a good, descriptive clue).
This is how you narrow down the problem and eventually get to fix it.
Good luck and tough nerves with Xcode .)
Z.
For me I just cleaned the project and it worked -> Product -> Clean
TLDR: Clear your Project Build Folder - and you will be free of this pain.
( plus I logged this as a bug with Apple as they need to find a way to fix this in Xcode )
None of these solutions worked for me - I banged my head against several walls.
I looked at the CoreSimulator log and I realised that it was trying to build a library that I had deleted.
I couldn't find references to it anywhere.
Then I saw via another SO Question which unfortunately I can't find to reference, if you:
Hold down your option key then Product-> Clean option becomes Clean
Build Folder
Press that and enjoy having your error vanish
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
In XCode 6
An error was encountered while running (Domain = LaunchServicesError,
Code = 0)
I had this error after making some major code changes to accommodate the iPhone 6 Screens. in Xcode 6 (iOS8)
I followed the options above and found that the only way to really get this fixed was by doing the following:
Deleted the derived data [go to Window >> Organizer >> (Find your App) Click on Delete next to the Derived Data]
Product >> Clean
Reset Contents and Settings in Simulator
Changed the Bundle Version to 1.4.1 from 1.4 in pList
Thank you for all the previous answers that got me to this stage. It worked a charm!
In my case, the error was caused because i didn't set the build id.
Setting this, launches the emulator without problem.
One other thing to try, that worked for me, after resetting the simulator and doing a clean build did not help, is clearing out the derived data. To do this: go to Organizer click on project click on delete derived data button. I had this happen after working on an extension for a while and went back to the regular branch. Hope this helps.
This is what caused the problem for me: the build number for the main app and the extension were different (I had incremented the main app build number to 1.0.1.03, but left the extension at 1.0.1.02).
Making them match fixed the problem for me.
Open the Console app and look there. In my case it told me exactly what to do. I saw:
ErrorDescription=WatchKit 2 app extension's NSExtension.NSExtensionAttributes.WKAppBundleIdentifier value does not match WatchKit app's bundle ID (found "com.myCompany.MyApp.MyApp.watchkitapp"; expected "com.myCompany.MyApp.watchkitapp").
So, I went to each plist and checked any items that related to a BundleID. Then Clean, relaunch, etc.
My case was about framework compilation. I have enabled the 'copy only when installing' option from Target- Build Phases- Embedded Frameworks-
I have an app that is set up to use different bundle IDs based on the build configuration. When creating my Apple Watch extension, Xcode generated everything using my Release ID, so I had to go through and change it all manually for debugging. Here's all the places I had to change it:
WatchKit Extension's Build Settings -> Packaging -> Product Bundle Identifier
WatchKit Extension's Info.plist -> NSExtension -> NSExtensionAttributes -> WKAppBundleIdentifier (this needs to use the same prefix as your companion app)
WatchKit App's Info.plist -> WKCompanionAppBundleIdentifier
The last one took me a while since the WatchKit App's Info doesn't show up as a tab when viewing the target settings, I had to go direct to the Info.plist file itself.
Try putting some number into [TARGETS]-[General]-[Identity]-[Version(or Build)], if they are empty.
It worked for me.
I hope it will help you.
I also have this error. In my case the log ~/Library/Logs/CoreSimulator/CoreSimulator.log was something like that :
Could not hardlink copy /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Containers/Bundle/Application/70F24DDC-7954-46BF-B799-F807FD98yyyy/myApp.app to /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/Payload/myApp.app with manifest /Users/myUser/Library/Developer/CoreSimulator/Devices/60E569E7-6750-428A-A401-841BB081xxxx/data/Library/Caches/com.apple.mobile.installd.staging/temp.kOrJ9G/extracted/com.apple.deltainstallcommands.com.mycompagny.myapp
thanks to this answer In look at my app info.plist. the key CFBundleVersion was missing so I add it and now everything is working !
None of the above worked for me, but this did:
I simply deleted IceCream.xcworkspace/xcuserdata/xcuserdatad and then reset the simulator and ran the app again. (Reseting the simulator alone, did not work for me.)
"Reset Content and Settings" from iOS Simutalor menu options and launching simulator after Quitting solved my issue.
The great explanation by Jeremy at least set me in the right direction, but despite having all the bundle identifiers and versions set correctly, the error still persisted. I then checked the Apple documentation which shows that the WatchKit extension (in its Copy Bundle Resources phase) copies the WatchKit app. This WatchKit app was named exactly the same as my iOS app, causing Xcode to confuse the two and read out the wrong plist, thinking the bundle identifier was incorrect. Renaming the Product of the WatchKit app to something distinct finally solved it for me.
If you've changed your bundle ID, make sure you do a clean build before trying to build it again! See how here: How to Empty Caches and Clean All Targets Xcode 4
So it's definitelly .plist problem. In my case it was empty NSExtensionMainStoryboard, removing this property fixed the problem
I had this error whilst trying to build Apple's Lister Xcode Project and run it on the simulator.
The essentials which fixed it for me were:
1) BundleID for the iOS App and the iOS Extension had to be different
2) I provide iCloud and App Groups for both targets
3) I used Xcode's "Fix Issue" to fix the issues
After that I could build and run the app without warnings or errors.
The clue from the log file was "... LegacyErrorString=DuplicateIdentifier, FunctionName=-[MIInstallableBundle performPreflightWithError:], SourceFileLine=450, NSLocalizedDescription=The parent bundle has the same identifier (com.ACMECompany.Lister) as sub-bundle at /Users/stephen/Library/Developer/CoreSimulator/Devices/5329928B-946B-40A4-B666-EFD11B96D11F/data/Library/Caches/com.apple.mobile.installd.staging/temp.HQ5d9X/extracted/Lister.app/PlugIns/Lister.appex"
Had a wrong app version set in InfoPlist.strings localization file. Urgh!
An hour gone!
Delete your simulator and regenerate one.
It works for me.
I removed the key in watch app's .plist file that shouldn't have been there. And the problem disappeared.
This worked for me:
In project settings -> General tab -> Identity section I changed the Version number from something like 2.0.2 (three digits) to 2.0 (two digits) then I deleted the app in the simulator and run the project again. No more error after that.
One other possible solution to add to all of the others that will no doubt stay above mine ;)
I deleted & later reinstated a Today Extension target retaining the source files, but after trying every solution under the sun, I realised it didn't have any sources or resources in its target! You might encounter this as well if your detailed launch services error can't find your compiled app extension file.
So, long story short, make sure your target has something included to compile or bundle in there. You can check your target memberships by selecting the relevant file(s) on your project navigator (on the left) and setting your checkmark(s) as appropriate in the file inspector (that's the first tab on the right).
I had the following in my log...
<Error>: Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=ExecutableTwiddleFailed...
This was due to there being no source files added in the extension project.
This error was showing up on my system when there was no hard disk space available. I freed up some space on my system for it to work.
My Problem was that the wrapper extension for the target project was unset.
To fix I had to go to target project -> build settings -> Packaging -> Wrapper Extension.
Set this to "app" (No quotes)
This fixed the problem for me

PhoneGap Xcode Missing Header files on Build 'Cordova/CDVViewController.h' file not found

I am using PhoneGap 2.2.0 and XCode 4.5.2.
I can test my programs in the simulators, and I can put them on my devices to test them.
But I simply cannot build for distribution. It always fails with the following error:
my-projevt-path/Classes/AppDelegate.h:30:9: 'Cordova/CDVViewController.h' file not found
I've seen this problem around the web and still can't make it work, given whatever solutions have been posted.
I've changed things in Build Settings, I've reinstalled PhoneGap, I've run new lines in terminal, I've done my app over starting a new PhoneGap project from scratch, I've checked preferences in the build location in Xcode... I can't figure this out AT ALL.
Please, can anyone help? I've been working on this for days.
Thanks!
Problems in Xcode
If you have compilation problems related to missing headers, the build products should build into the same build directory. You may need to set the preference "Xcode Preferences -> Locations -> Derived Data -> Advanced…" to "Unique". This is the default setting for Xcode on a fresh new install, if you upgraded from older versions of Xcode, you might have a legacy preference in there that you need to update.
Found the answer!!!
Yes I am getting the same problem yeah and some help could be great.....
I followed all the instructions even with the ./update_cordova_subproject path as well it does not work. Also I solved the locking problem but I could not find the solution to this problem
The answer, in my case, had seemingly nothing to do with the error message that was being sent. Missing header files? That didn't seem to be the issue. Or, at least, not the direct cause of the issue.
This was an issue with my provisioning/certificates being somehow not right. I had re-created them several times, but it continued to be an issue.
I sent the job to another developer, who opened it on his machine, revoked my certificates and created new ones, and built it without changing anything else. He forwarded me the certificate, the provisioning, and an archive of the job. I opened the archive in xCode and validated it and uploaded it. And it was fine.
If you have got this problem, be certain your certificate/provisioning is set up right. I thought mine was, but apparently it wasn't? The "Apple Process" is definitely weird, and when certificates / profiles gets messed up, problems arise.
I was having the same problem and just solved it! First of the problem may very well be because of your distribution provisioning files... but when you look at the Project Navigator in xCode at the top level you have your Project and inside you have the CordovaLib.xcodeproj click on this file and you will see the iOS Deployment target. Make sure the proper IOS version is selected there. This is 1/2.
2) Then you need to duplicate the Release configuration and rename it Distribution. While the CordovaLib.xcodeproj is selected make a build and then build the actual project. This worked smoothly for me.
Add this line to your Build Settings -> Header Search Paths:
$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
Don't replace the existing line that looks similar, that is still needed to be backwards compatible with Xcode 7 and Xcode 6.4.

Resources