Attach process failed when trying to run intents extension via Xcode

Issue Summary

Hi all,

I'm working on an Intents Extension for my app, however when I try to run an intent, Xcode pops up the following error:

Could not attach to pid: "965"

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

An image of the error:

This only happens when I try debugging the Intent Extension. Running the main app target or another extension target (e.g. notifications) doesn't produce this error.

Build Setup

Here are the details of my build setup:

  • Mac Mini M1
  • Xcode 13
  • Building to iPhone 11 Pro Max, iOS 15.0.2. I've also tried building to my iPad Pro 12.9 w/ iOS 15.1 and hit the same issue.

Things I've tried:

  • Make sure "Debug executable" is unchecked in the scheme
  • I've tried changing the Launch setting to "Automatic" and "Wait for the executable to be launched"
  • I've made sure to run sudo DevToolsSecurity -enable on my mac
  • Rebooted iPhone devices + mac mini
  • Uninstalled / reinstalled the app
  • Deleted derived data
  • Removing / reinstalling the development certs in my keychain --> this actually seemed to work initially, but then the problem came back and now it doesn't work anymore.

Console Logs

I've looked at the console logs while this error occurs to see if it can shed light on the issue. Here are the ones that seemed notable to me.

These logs seem to show that Siri is trying to save / write to a file that it does not have access too. Seems very suspicious

error	11:42:38.341470-0800	kernel	System Policy: assistantd(31) deny(1) file-read-metadata /private/var/mobile/Library/com.apple.siri.inference
error	11:42:38.342204-0800	assistantd	failed to save contact runtime data. error=Error Domain=NSCocoaErrorDomain Code=512 "The file “com.apple.siri.inference” couldn’t be saved in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/com.apple.siri.inference, NSUnderlyingError=0x100fb03a0 {Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error"}}
error	11:42:38.342403-0800	assistantd	InferenceError<errorId=crSaveToRunTimeDBFailed file=/Library/Caches/com.apple.xbs/Sources/SiriInference/SiriInference-3100.49.3.1.2/SiriInference/SiriInference/ContactResolver/ContactResolver.swift function=logRunTimeData(runTimeData:config:) line=378 msg=>
error	11:42:38.465702-0800	kernel	1 duplicate report for System Policy: assistantd(31) deny(1) file-read-metadata /private/var/mobile/Library/com.apple.siri.inference

Looking for "debugserver" entries, like the error suggests, shows these logs:

default	11:42:44.814362-0800	debugserver	error: [LaunchAttach] MachTask::TaskPortForProcessID task_for_pid(965) failed: ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure)
default	11:42:44.814476-0800	debugserver	10 +0.011525 sec [03c6/0103]: error: ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) err = ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) (0x00000005)
default	11:42:44.825704-0800	debugserver	error: MachTask::StartExceptionThread (): task invalid, exception thread start failed.
default	11:42:44.825918-0800	debugserver	error: [LaunchAttach] END (966) MachProcess::AttachForDebug failed to start exception thread attaching to pid 965: unable to start the exception thread
default	11:42:44.826025-0800	debugserver	error: Attach failed
default	11:42:44.828923-0800	debugserver	error: 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.".

I've also attached the full details of the error below via a text file if it helps.

Any help with this issue would be great, and I'm happy to provide more information if needed. Thanks in advance!

Replies

Just wanted to add some additional information... I stumbled across this apple forum post, which shows similar Console.app logs. I verified that these things were true in my app:

  • CODE_SIGN_INJECT_BASE_ENTITLEMENTS == YES
  • DEPLOYMENT_POSTPROCESSING == NO
  • I checked the entitlements on my app and verified that the get-task-allow is present:
	<key>get-task-allow</key>
	<true/>

I have same issue now. Did you solve this? If you did, please let me know your solution.