Search code examples
iosiphonexcode

XCode error on iOS17: Could not attach to pid


I just got a new phone (same model) and I am trying to run my (Flutter) app. However, I'm running into an attach by pid '####' failed -- attach failed Not allowed to attach to process. error during the “Installing and Launching” phase. I know it's an issue of some missing setup on the new device because I have the old phone (for now) and am still able to build my app on it without issue.

I think the problem is that I haven't explicitly trusted the developer profile from Settings, but there is no accessible option to do so. In my settings: General/VPN & Device Management just shows VPN and an option to Sign In to Work or School Account with no mention of profiles or trusting a developer. This doesn't change if the phone is connected and Xcode open/running, as some answers suggest.

Not sure if this is an issue with the new version of iOS, or if there's something else I'm missing- but nothing from the many threads I've read has helped so far. Looking for a solution to this for iOS 17.4.1.

I have tried just about everything I can find on this issue, including:

  • Cleaning the Xcode build folder and removing DerivedData
  • Restarting my phone and computer
  • Toggling on/off developer mode on my phone
  • Signing in to my developer account on the mobile app
  • Running with phone Wi-Fi and Bluetooth turned off
  • Clearing and retrusting the computer from my phone
  • Resetting phone “Network Settings” as well as “Location and Privacy”
  • Creating a new runner scheme
  • Xcode > Devices and Simulators > Right click on “Phone” > remove installed certificates

It's an issue with iOS 17.4.1+. I upgraded my old phone to the latest iOS, and it now runs into the same error.

Slowly porting everything over from my old app to the new project to find the issue. It's not:

  • Any of my 3rd party packages (identical pubspec.yaml)
  • Anything to do with Pods (identical Podfile)
  • Any settings in Info.plist

Solution

  • Solved it. You need to delete ALL of your XCode Schemes and remake them.

    see https://github.com/flutter/flutter/issues/142502#issuecomment-1935453723