iPhone simulator reporting error when re-installing an app from Xcode - ios

I'm using Xcode 6 with the iOS Simulator version 8.1 (build 550.3).
When I choose the "Build and Run" in Xcode everything works good, if the app isn't already installed in the simulator. If it is, however, I get the following error in Xcode:
Unable to run app in Simulator
An error was encountered while running (Domain = LaunchServicesError, Code = 0)
And the logs for the simulator show the following:
less ~/Library/Logs/CoreSimulator/CoreSimulator.log
Nov 6 11:53:47 Yggdrasil.local com.apple.dt.Xcode[4389] <Error>:
Error Domain=LaunchServicesError Code=0 "The operation couldn’t be completed.
(LaunchServicesError error 0.)" UserInfo=0x7fa697742360
{Error=PackagePatchFailed, ErrorDescription=Could not hardlink copy
/Volumes/UsersData/Users/kender/Library/Developer/CoreSimulator/Devices/AAD57C40-E208-4964-B63A-46B968B3EB36/data/Containers/Bundle/Application/FEE2DEB4-AEE3-48B7-BE71-5B027259C6FD/Baby Feeding.app
to /Volumes/UsersData/Users/kender/Library/Developer/CoreSimulator/Devices/AAD57C40-E208-4964-B63A-46B968B3EB36/data/Library/Caches/com.apple.mobile.installd.staging/temp.P8QJEE/extracted/Payload/Baby Feeding.app
with manifest /Volumes/UsersData/Users/kender/Library/Developer/CoreSimulator/Devices/AAD57C40-E208-4964-B63A-46B968B3EB36/data/Library/Caches/com.apple.mobile.installd.staging/temp.P8QJEE/extracted/com.apple.deltainstallcommands.com.owlcoding.babyfeeding}
(/Volumes/UsersData/Users/kender is my $HOME).
I tried to remove all simulators (from the Devices window in Xcode and re-add them - no luck.
I removed the entire ~/Library/Developer directory and allowed Xcode to recreate it - same issue after that.
So right now I'm stuck with Build and Run -> Make changes -> Remove app -> Build and Run flow, which kind of sucks... Anyone encountered a problem like this and found a solution, or maybe you guys have some pointers for me...

I had the same problem and it was due to localisation of the Info.plist.
My app is localised into several languages and each localisation has an InfoPlist.strings file with the CFBundleShortVersionString key. I had changed the Version string on the Target information, but not in the InfoPlist.strings files.
So I deleted the app in the Simulator, updated CFBundleShortVersionString in all the localised Info.plist files to match the version on the Target, and that resolved the issue for me.

The error indicates that installation failed because of hard linking. I suspect the filesystem for your $HOME does not support hard links. Please update your question to specify what type of filesystem /Volumes/UsersData is.
If it's not possible to support hard links on /Volumes/UsersData, then I suggest you make a local directory for your simulator data and create a symlink from ~/Library/Developer/CoreSimulator/Devices to it.
Also on a side note, deleting all of ~/Library/Developer can wreck havoc on the running simulator service. If you do that, make sure Xcode, iOS Simulator, Instruments, etc are quit, but ALSO make sure the service is killed as well by running killall -9 com.apple.CoreSimulator.CoreSimulatorService

Related

Xcode 14 is not getting attached to Simulator in Debug mode

While debugging any iOS application, Xcode builds and run successfully, also launches a simulator but it is not able to attach debugger from Xcode 14 to Simulator iOS app.
It throws an error in Xcode:
Xcode console says:
Could not attach to pid : “75997” Domain: IDEDebugSessionErrorDomain
Code: 3 Failure Reason: attach failed (Not allowed to attach to
process. Look in the console messages (Console.app), near the
debugserver entries, when the attach failed. The subsystem that
denied the attach permission will likely have logged an informative
message about why it was denied.) User Info: {
DVTRadarComponentKey = 855031;
IDERunOperationFailingWorker = DBGLLDBLauncher;
RawUnderlyingErrorMessage = "attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the
debugserver entries, when the attach failed. The subsystem that
denied the attach permission will likely have logged an informative
message about why it was denied.)"; }
Tried with re-installing Xcode and Command line tools, but issue persists.
Steps:
Build and run app with Debug executables true
Simulator gets launched
Error on Xcode and it gets disconnected from simulator
Is there a possibility that it can be blocked by any other app, if so how to identify ?
I solved the issue by doing the steps below:
SOLUTION 1:
Edit the scheme
Select Run
Select Build Configuration "Debug"
Select "Wait for the executable to be launched"
Close
Run the app
see the screenshot here
You will receive an error message when you run the app again.
Close the app.
Edit the scheme again and change "Wait for the executable to be launched" to "Automatically".
Now your simulator will work as expected.
SOLUTION 2:
Delete your app folder in Derived Data
/Users/[your username]/Library/Developer/Xcode/DerivedData/
Search your app name folders and delete them.
SOLUTION 3:
Open the terminal and run:
sudo DevToolsSecurity -enable
This command enables the Developer Mode. After running the command you will receive this message: [Developer mode is now enabled].
Sometimes it's happen, when you are trying to build too fast after a build has started.
First of all, quit your current simulator, delete derived data and clean the project, wait until whole processing is complete. Then do some changes / editing if required (as we clean all data) and try running on a different simulator.
Check certificates in key-chain access, if you found any untrusted certificates in key-chain access remove it.
Also if you are using beta version just make sure it is downloaded from Apple official website.
Came here to share my (strange) solution if anybody crosses the same problem with no answers working. In my case, no solution from this nor other SO answers to similar questions worked (cleaning, rebuilding project, updating, clearing derived data..)
My setup is:
Macbook M1 2022 + Xcode Version 14.2 (14C18)
This Xcode version could not attach to any of my apps (fresh new or previously developed) on different simulators (11, 12, 14) with iOS versions 13.7 - 16.2.
Editing scheme solution from answer above was not working also so I ended up in leaving scheme as:
Build configuration: Release
Debug executable Deselected(!)
Launch Automatically
And magically debugging app in Xcode started working even though it's release version with debug option deselected.. Selecting Debug executable again makes Xcode not possible in attaching to app process
Just to clarify: above steps actually makes app to run as in DEBUG mode - Xcode attaches to pid, I can do console logs and breakpoints. This Xcode version behaves opposite than options selected

Xcode 12 error in installing app -Failed to get FD to bundle executable

My project is running fine in Xcode 11.3 but recently when I upgraded to Xcode 12 app is not getting installed in simulator and showing the error - Could not install at this time.
Failed to get FD to bundle executable....
I suddenly had the same problem, after years of work on the same project across several versions of Xcode and MacOS.
On Xcode 12.4 and MacOS 10.15.5, although everything was working fine, suddenly I got this error popup "Failed to get FD to bundle executable" while trying to Run the project on a(ny) Simulator.
I tried all the proposals I could find online, including changing the Executable Type (which had never changed) or clear the empty env vars defined in the Build settings (there weren't any). Uninstalling/reinstalling Xcode didn't help. Upgrading to MacOS 10.15.7 didn't either. Of course the Apple Support has been of no use at all (they replied with a few general FAQ links about how to use Simulator).
The only thing that worked for me was to checkout the project in a different folder...
The weird thing is, if I rename again my new folder to the initial folder name, it does the error again! It sounds to me like a MacOS bug and/or an Xcode bug.
Error running `xcrun simctl install 95F3A7B0-67B3-490E-B798-D1CBBF813B83 /Users/yakjuly/.expo/ios-simulator-app-cache/Exponent-2.21.3.tar.app`: An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
Unable To Install “Expo Go”
Please try again later.
Failed to get FD to bundle executable at /Users/yakjuly/Library/Developer/CoreSimulator/Devices/95F3A7B0-67B3-490E-B798-D1CBBF813B83/data/Library/Caches/com.apple.mobile.installd.staging/temp.Nf39ZM/extracted/Exponent-2.21.3.tar.app/Expo Go
Underlying error (domain=MIInstallerErrorDomain, code=4):
Failed to get FD to bundle executable at /Users/yakjuly/Library/Developer/CoreSimulator/Devices/95F3A7B0-67B3-490E-B798-D1CBBF813B83/data/Library/Caches/com.apple.mobile.installd.staging/temp.Nf39ZM/extracted/Exponent-2.21.3.tar.app/Expo Go
I have this problem when I get started with react native.
The issue for me is the file in /Users/yakjuly/.expo/ios-simulator-app-cache/Exponent-2.21.3.tar.app is broken. After I delete this file and re-run the command. it succeeds installing app in iOS simulator.
What solved this for me was the following:
close emulator
clean project and build folder
Shortcut: Command+Shift+K
GUI: Menu Bar -> Product -> Clean/Clean Build Folder
restart emulator
Xcode 13.2.1
The following steps helped me -
1. Select simulator
2. Goto Device
3. Select -> Erase All Content and Settings...
Hopefully, now you will be able to install and run the app on your simulator.

Problem with running IOS simulator for my flutter app

I'm trying to run my flutter app on the IOS simulator and its not working. So tried on the most basic flutter app (create my_app and then tried to run it) and nothing seem to work!
Everything seems to work fine when I run it from the terminal until the linking and signing phase and that where I get the error, how can I fix it?
This is the error I get:
Unable to install
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app on
82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15. This is sometimes caused by a malformed
plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command
(domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Could not install at this time.
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8B
B9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoord
inationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-BC2E
82D37D17/my_app.app to installd
Underlying error (domain=MIInstallerErrorDomain, code=103):
Failed to transfer ownership of path
/Users/MyUserName/Library/Developer/CoreSimulator/Devices/82562E3A-E7BD-4FE0-9BF9-8
BB9C7AD5F15/data/Containers/Shared/SystemGroup/systemgroup.com.apple.installcoo
rdinationd/Library/InstallCoordination/PromiseStaging/98CD703F-760F-4AAE-B991-B
C2E82D37D17/my_app.app to installd
Command: /usr/bin/xcrun simctl install 82562E3A-E7BD-4FE0-9BF9-8BB9C7AD5F15
/Users/MyUserName/Desktop/my_app/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 11 Pro Max.
Edit:
I updated my MacOS, Deeleted and reinstalled Xcode, I even tried to run the most simple swift app and I get always this same error, it looks like the build was successful but it unable to install. I still get this same error, what can I do?
This occurred when I opened the Simulator first and then updated XCode -- even without running the app until after XCode updated completely.
What worked for me:
Close Simulator completely (from the dock, right-click -> "Quit")
Close XCode (if applicable)
Run flutter clean
Re-open Simulator
Re-open XCode and let it compile
Run the app again
If it still does not work, try resetting the device at "Device" -> "Erase All Content and Settings..." from the Simulator menu.
I had the same issue a couple of days ago
What I did - and what fixed the problem - was to reset the simulator (Device -> Erase All Content and Settings), and then run $ flutter clean
You should now be able to run your app again
None of the above worked for me. I created another flutter application and copied it's ios folder to my project. Worked like a charm
Save time, just go to erase device content and settings from the emulator, then run flutter clean. App should run fine then.
Run flutter clean and then run your app again
If error persist, generate a new flutter project on Android studio. Replace the ${projectHome}/ios/Runner.xcodeproj folder with the ${newFlutterProjectHome}/iOS/Runner.xcodeproj. Your app should run fine now.
If error persist still, delete the ios folder and replace it with a new one copied from a freshly generated project.
This happens if the GoogleService-Info.plist is missing.
This also happens when you have updated your XCode and your simulator is in the background.
Close the simulator and open the Xcode, you will get an option to install additional tools, install them and then run the application.
An alternate solution is to run the Runner.xcworkspace app once from Xcode and this may fix it.
In my case it was because of hanging empty GoogleService-Info.plist file inside Xcode after migrating to new Firebase (FlutterFire) initialization.
Xcode is not a regular drag and drop IDE which directly maps project files to the ones in the file system. It rather caches file references. So even when you delete a .plist file, the Xcode still maintains a reference to it.
Simply opened Xcode IDE and removed .plist file (which updated project.pbxproj in turn). This helped me to compile the project fine.
I had this same issue recently. I found out I added my GoogleService-info.plist file to the subdirectory Runner and not the main Project directory Runner through xcode. I opened up xcode again, deleted the file and re-added it to the proper place and now everything is working correctly.
for this you have to give some value in CfBundleVersionShortString like
<key>CFBundleShortVersionString</key>
<string>1.0</string>
And Give the build value in Runner as 1.0 and version as 1.0
enter image description here
To be honest. it's really frustrating for the developers
This is how I fixed!
flutter clean
flutter pub get
go to ios folder
rm Podfile.lock
pod repo update
pod install
Then it works!

Xcode Storyboard file was broken suddenly

My Xcode is 10.1 and has been used for over 6 months. Before upgrading Security-Updates-2009-001 from App Store in MacOS X High Sierra 10.13.6, my Xcode quitted frequently and accidentally. Today, after upgrading the security path, it finally broke my Xcode and my Storyboard in projects suddenly as the images below.
It doesn't work even I checkout my Git to previous versions. It seems that the Xcode was something wrong inside, and so does my Simulators. The Xcode cannot launch any Simulators at all and always shows "Unable to boot simulator", no matter I launch it from Scheme Building or Launchpad.
I have been testing all solutions on boards to try to recover my Simulators and Storyboards, but it doesn't work. Does anyone can give me more assistance to solve it?
Unable to boot the Simulator.
The broken Storyboard looks like this one.. and the Log text file shows
Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS failed to launch): Failed to boot device iPhone 8 (E28478CE-81DC-4B16-A12E-16AA7086BE31, iOS 12.0, Shutdown) for context ...... The folder “disabled.plist” doesn’t exist. (Failure reason: The folder doesn’t exist.): The operation couldn’t be completed. No such file or directory (Failure reason: No such file or directory).....
and it is useless to uninstall and re-install Xcode again and again from 10.1 to 10.0 and to 10.1 again
The below permissions are worked for me.
sudo chmod -R 777 /private/tmp/
After trying again and again, I finally deleted all Xcode and re-installed Xcode 10.1 again and then changed the permission and ownership of the folder /private/tmp to 777 and root:wheel, and it finally works back!! Storyboard and xib files are workable now.
Reference: https://forums.developer.apple.com/thread/66665
This might be an issue of Command Line Tools resetting it may fix up your problem...
Run xcode-select --reset in your terminal and tell me if it works for you : D
I have spent more than 6 hours on this. Restarting the Xcode fixed it

Xcode 10.1 Can't Find or Create iOS Simulators

For context I am working with a fresh install of macOS Mojave and a fresh install of Xcode 10.1.
The first thing I noticed was I only had the option of
Generic iOS Device from the simulator drop down list. It seems Xcode did not download any iOS simulators with it like I thought it was supposed to.
So I went looking in the simulator list, and it was empty. So the next logical step is to try and create a simulator. Where I only found the ability to download simulators. So I downloaded four simulators and went back to try and create them. Nothing changed, I could still only download simulators. I wasn't about to select a device or a simulator.
I have tried restarting Xcode, the OS, and reinstalling Xcode none of which have worked. I have tried deleting DerivedData, but that didn't work either. So, I am now at a point where my Google searches are just turning up the same tired answers, and I am getting no where.
Edit
Here is the error message I get if I try to build anything, if it helps.
2018-12-07 05:49:31.315 ibtoold[1550:71807] Error
Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo=
{NSLocalizedDescription=CoreSimulator.framework was changed while the
process was running. This is not a supported configuration and can occur
if Xcode.app was updated while the process was running. Service name
((null)) does not match expected service name
(com.apple.CoreSimulator.CoreSimulatorService).} 2018-12-07 05:49:31.315
ibtoold[1550:71807] Failed to load CoreSimulatorService. Access to
simulator services will not be available. Error=Error
Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo=
{NSLocalizedDescription=CoreSimulator.framework was changed while the
process was running. This is not a supported configuration and can occur
if Xcode.app was updated while the process was running. Service name
((null)) does not match expected service name
(com.apple.CoreSimulator.CoreSimulatorService).} 2018-12-07 05:49:31.400
ibtoold[1550:71824] CoreSimulatorService connection became invalid.
Simulator services will no longer be available.
I was facing the same issue. I tried each and everything that Google has said. But didn't find any solution. So, finally, I removed all the Xcode from the system and update the mac os with Mojave 10.14(earlier it was 10.13). Then I reinstall the Xcode 10.1. This time Xcode asked the permission to install extra components. After installation of these components, I am able to see the list of all the simulators.
The problem, what I have observed, was that there was no device present in the core simulator folder under the library/developer. Please check if this folder present or not on the following path: Users/Library/Developer/CoreSimulator/Devices.

Resources