Error Message
I am getting this error message whenever I try to run any of my iOS projects on the simulator. How do I get rid of this?
I have already tried Cleaning the build folder, and erasing all content and settings of the simulator, tried different simulators as well as closing and starting the Xcode again.
Details
Could not attach to pid : “3386”
Domain: IDEDebugSessionErrorDomain
Code: 3
Failure Reason: lost connection
User Info: {
DVTRadarComponentKey = 855031;
RawUnderlyingErrorMessage = "lost connection";
}
--
System Information
macOS Version 12.0 (Build 21A5304g)
Xcode 12.5.1 (18212) (Build 12E507)
Timestamp: 2021-08-25T12:20:16+05:00
It might be an issue with authorization, Try below lines in terminal.
sudo DevToolsSecurity -enable
Untick the debug executable.
Edit Scheme > Run > Debug executable
This problem might be related to the beta version of macOS that you use.
I suggest using the Xcode 13 Beta from Apple for developers.
You need a free apple developer account to access this download.
For me this solved all problems.
Was getting this error in the console:
com.apple.debugserver) may not get the task control port of (appName) (pid: 1976): (appName) is hardened, (appName) doesn't have get-task-allow, (com.apple.debugserver) is a declared debugger(com.apple.debugserver) is not a declared read-only debugger
Set Build settings of CODE_SIGN_INJECT_BASE_ENTITLEMENTS to YES for Debug Level.
Related
I have recently upgraded the Mac OS to Ventura 13.2.1 and Xcode to 14.2, now once I try to compile any application with Xcode, I am getting Kill:9 related issue for random task/framework in the project. I also get Kill:9 issue sometime on terminal as well.
Listing the errors here:
failed to read asset tags: The command `` terminated with uncaught signal 9. The command had no output.
Driver threw jobFailedWithNonzeroExitCode(9, "") without emitting errors.
Unable to execute command: Killed 9 Clang frontend command failed due to signal.
Please help me to resolve this issue/crash.
Open project in Xcode.
Build the app with Simulator (I tried with iPhone 14 Pro)
Error occurs in the build
Ideally project should have compiled without any error.
It sounds to me that the problem is with the installation of Xcode because when an unprivileged task is attempted, the OS will kill it off (with signal 9).
What I recommend is for you to re-install Xcode.
When you first run the new Xcode, it should prompt you for an administrator password in order to install system related components. Make sure you do this step. Hopefully that should then allow you to compile and run your iOS apps.
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
I have a Xcode project. Just a simple dummy project that I use for compiling for VS2019 on my windows. VS2019 can't open the storyboard any more after I updated windows, vs2019 and Mac.
So I tried to run it on my Mac first, and should everything work I could try my VS2019 project again.
I also have Visual Studio for mac installed. When I create the same dummy project for my Xcode project the storyboard does not open in design mode.
I get the same error every time. The connection between my windows Xamarin project works. But also I get the same error here. The Storyboard won't open in design mode.
Mac :
Error : Unable to erase contents and settings in current state: Booted
VS2019 : Couldn't find a Devicelog for [ConnectionAttributes:Device=Undefined......
What have I tried already:
Everything is updated, no more updates are available.
I've removed all my devices in the simulator and added them back again.
I've opened my storyboard in Xcode and saved it.
I've removed my storyboard and added a new one.
Firewall is disabled, so that should not be a problem.
Xcode : 11.2.1 (11B500)
Visual Studio : 8.3.10 (build 2)
IOS : Catalina 10.15.1
Every forum, every site I've read already. A least that's how it feels.
I really could use some tips.
This is the complete error:
System.AggregateException: One or more errors occurred. (One or more errors occurred. (Exception of type 'MonoTouch.Design.Client.InvalidSessionException' was thrown.)) ---> System.AggregateException: One or more errors occurred. (Exception of type 'MonoTouch.Design.Client.InvalidSessionException' was thrown.) ---> MonoTouch.Design.Client.InvalidSessionException: Exception of type 'MonoTouch.Design.Client.InvalidSessionException' was thrown. ---> Foundation.NSErrorException: Error Domain=com.apple.CoreSimulator.SimError Code=165 "Unable to erase contents and settings in current state: Booted" UserInfo={NSLocalizedDescription=Unable to erase contents and settings in current state: Booted}
at MonoTouch.Hosting.Device.ResetContentAndSettings () [0x0001d] in <04dc5ca6c35a46aa8bc6e6cd7c986dae>:0
at MonoTouch.Design.Client.Mac.MacServerProcessConnection.EnsureServerRunning (System.Boolean throwIfNotRunning) [0x000ff] in /Users/runner/runners/2.160.0/work/1/s/Xamarin.Designer.iOS/MonoTouch.Design.Client.Mac/MacServerProcessConnection.cs:298
--- End of inner exception stack trace ---
And more but the number of characters is restricted.
The solution was to install Mojave in stead of Catalina and reinstall everything. Keer both sides of the mac and pc sync.
I was able to fix the problem with the following command in terminal:
xcrun simctl shutdown all
Update: Seems like this issue starts when you force close apps. After two days of successful work I received the same message. I did command above, after that added xcrun simctl erase all, rebooted. Issue was still there. Finally I got how to fix it.
Solution: You should open xib, it will start spinning and during that open terminal and run xcrun simctl shutdown all. After that the issue will be resolved.
I installed the Xcode-11-beta along with macOS 10.15 beta. At first I can play with SwiftUI preview normally. But after I tried to move the Xcode-beta from the ~/Downloads directory where I initially installed it, to /Applications, the preview can't work. Here is the error:
So I moved it back to ~/Downloads, hoping things will go well as before. But it gives the same error.
After this, I reinstalled it and I still got this error. Can anyone help me fix it?
The content of diagnostics report is this:
== DATE:
Wednesday, June 5, 2019 at 10:25:46 PM China Standard Time
== PENDING U
PDATE REASONS:
== PREVIEW UPDATE ERROR:
unexpected error occurred
Error Domain=com.apple.CoreSimulator.SimError Code=161 "The iOS 13.0 simulator runtime is not available." UserInfo={NSLocalizedRecoverySuggestion=Download the iOS 13.0 simulator runtime from the Components section in Xcode's Preferences., NSLocalizedFailureReason=runtime path not found, NSLocalizedDescription=The iOS 13.0 simulator runtime is not available.}
== VERSION INFO:
Tools: 11M336w
OS: 19A471t
== ENVIRONMENT:
[x] In valid workspace
[x] Project is using the new build system
Previews are available for targets that are built with the new build system. Change your project to use the new build system.
[x] Selected scheme (Landmarks)
Select a scheme from the scheme picker in the toolbar
[x] Selected run destination (iPhone 8)
Select a run destination from the scheme picker in the toolbar
[x] Have workspace arena
Try quitting and reopening your workspace
[x] Have build arena
Try quitting and reopening your workspace
[x] Open file has supported build settings
CoreSimulator does not currently like simruntime bundles being moved out from under it. By launching from ~/Downloads it became aware of the iOS.simruntime for iOS 13, then you moved it.
In this one specific case you can workaround the problem by killing com.apple.CoreSimulator.CoreSimulatorService.
Weird thing is I wake up in the morning and start my computer, the Canvas and the iOS 13.0 Simulator can work now.
So, I guess the solution to this may be just a brutal restart. ;]
The XCode 11 upgrade breaks simulators in a weird way that I don't fully understand - nothing I tried would work to get simulators to run after the upgrade, and I couldn't find much in the way of clear answers as to why that was the case, but the following two commands fixed the issue for me:
sudo xcrun simctl shutdown all
sudo xcrun simctl erase all
When trying to run any of the projects that I usually run I'm getting the following errors for different simulators:
The request was denied by service delegate (SBMainWorkspace) for reason: unspecified on iOS 10.0+ simulator
The operation could not be completed (FBSOpenApplicationErrorDomain error 1) on iOS 9.3 simulator.
This issue began when I tried installing a previous version of Xcode 8.2.1 from what I had been using (8.3). I couldn't build any projects in the 8.2.1, but I could still build in 8.3. I named the 8.2.1 a different name in order to be able to run them side by side. This was something I had done before. However, I needed 8.2.1 for a project and so I deleted both and then reinstalled just 8.2.1 according to this post: How to Completely Uninstall Xcode and Clear All Settings.
I've checked the scheme settings in Product > Scheme > Edit scheme > Run > Environment Variables and I've made sure there are no empty environment variables checked. I don't have any environment variables at all now.
I've reset content and settings on the simulators.
I've created a new simulator of a different iOS version. Originally I was just trying on 9.3 and 10.3. I then downloaded the 10.0 and 10.2 and still have the same issue occurring.
I consistently clean my project before running, both (shift + cmd + K) and (shift + alt/option + cmd + K).
I've rebooted my system. I've done everything I can think of. The issue still prevails. What am I missing?!
FBSOpenApplicationErrorDomain error 1, "unspecified" is a catch-all error code for something going wrong during launch that wasn't covered by another error code. There are a couple possible causes for this error code, and it is unfortunate that they do not get displayed in the UI.
I suggest you look in the simulated device's system log to uncover the real cause for the failure. Run this to see all the logs from CoreSimulatorBridge as that logs the full error when it gets it:
xcrun simctl spawn booted log show --info --debug --predicate 'processImagePath contains "CoreSimulatorBridge"'
If that isn't descriptive enough, you might want to also look at the logs for SpringBoard or assertiond, or just use --start and --end to see all the logs for the relevant time range.