I get "Failed to prepare device for development." on my iPhone for development

When I go to Windows->"Devices and Simulators".

I get:

"Failed to prepare device for development."

"If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device."

I, of course, tried disconnecting and reconnecting, with no change.

My iPhone is iPhone 12 Pro with 14.3 (18C66)

My xCode is Version 12.3 (12C33)




Post not yet marked as solved Up vote post of timander Down vote post of timander
27k views

Replies

I've had the same problem with iOS 14.4 (18D5030e)

The remote device connection terminated with an error.
Domain: com.apple.dtdevicekit
Code: 802
Failure Reason: The device finished with the error code -402653083 ("Could not connect to the device.").
Recovery Suggestion: Please check your connection to your device.
User Info: {
  DVTDeviceErrorIsProxied = 1;
  DVTRadarComponentKey = 487927;
}
  • -

Could not connect to the device.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653083
User Info: {
  DVTRadarComponentKey = 261622;
  MobileDeviceErrorCode = "(0xE8000065)";
  "com.apple.dtdevicekit.stacktrace" = (
0  DTDeviceKitBase           0x000000012f0aac8f DTDKCreateNSErrorFromAMDErrorCode + 220
1  DTDeviceKitBase           0x000000012f0c0f96 -[DTDKCopyValueRequest finishWithResult:andError:] + 490
2  DTDeviceKitBase           0x000000012f0bc67b _60-[DTDKRemoteDeviceConnection primitiveDrainPendingRequests]blockinvoke3 + 213
3  DVTFoundation            0x000000010ffa117e DVT
CALLINGCLIENTBLOCK + 7
4  DVTFoundation            0x000000010ffa2da0 _DVTDispatchAsyncblockinvoke + 1191
5  libdispatch.dylib          0x00007fff201ed5dd
dispatchcallblockandrelease + 12
6  libdispatch.dylib          0x00007fff201ee7c7 dispatchclientcallout + 8
7  libdispatch.dylib          0x00007fff201f1195
dispatchcontinuationpop + 423
8  libdispatch.dylib          0x00007fff201f0868 dispatchasyncredirectinvoke + 713
9  libdispatch.dylib          0x00007fff201fd857 dispatchrootqueuedrain + 326
10 libdispatch.dylib          0x00007fff201fdfb8 dispatchworkerthread2 + 92
11 libsystem
pthread.dylib       0x00007fff20396453 pthreadwqthread + 244
12 libsystempthread.dylib       0x00007fff20395467 startwqthread + 15
);
}
  • -


System Information

macOS Version 11.2 (Build 20D5029f)
Xcode 12.3 (17715) (Build 12C33)
Timestamp: 2021-01-09T15:19:40Z
Same on iphone 12 pro max, reconnecting and restarting made no difference.
Restarting my iPhone fixed this right away for me.
iOS 14.4 (18D52)

System Information
macOS Version 11.2.1 (Build 20D74)
Xcode 12.4 (17801) (Build 12D4e)

Failed to prepare device for development.
Domain: com.apple.dtdevicekit
Code: 806

Recovery Suggestion: If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device.

User Info: {

    AssociatedMobileDeviceFunction = AMDeviceMountImage;

    DVTRadarComponentKey = 487927;

    NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running.";

}
Same happened to me with an iPhone 12 Pro Max with iOS14.4 installed along with Xcode 12.4.

The only solution that worked for me was restarting the iPhone.
I've just opened a bug report FB9019586
I had the same issue with my iPhone 12 Pro Max with iOS 14.4.1 installed along with Xcode 12.4
Restarting my phone solved the issue for me.

~~Hmm. Seems like I had to go into Keychain Access > Certificates > Apple Worldwide Developer Relations Certificate Authority for one expiring in 2030 & change Trust to System Default. It was set to Always, and this fixed my issue. ~~

  • Didn't work for me.

  • But rebooting the phone does work. I seem to need to reboot the phone a few times a week for XCode to not give the error.

  • Rebooting both my phone and computer do nothing. I'm tearing my hair out, this is infuriating, lol

Oh, seems I'm running 14.6 and 11.4, and the current version of Xcode only supports up to 14.5 and macOS 11.3. Welp, issue identified.

Restarting my iPhone 12 Pro also worked for me

I'm running iOS 15.1 (19B74) on an iPhone 13 Pro Max., and XCode 13.1

I was having this problem. Taking a hint from an answer above (in this thread), I checked KeyChain Access -> Certificates and I found duplicated Apple Worldwide Developer Relations Certificate Authority, one expiring in 2023, and another expiring in 2030. I deleted the 2023 one. I also saw some expired developer certificates/authorities, and got rid of those.

I double clicked a few of the certs I know I trust and set the trust dropdown selection from "Use system defaults" to "trust".

All that resolved it. Maybe that entailed more than I needed to to resolve it, but it works now.

  • fixed my problem

  • Fixed my problem as well.

  • Fixed my problem but the other way around.

    Trust was set to "Use custom settings" yet, although there are no values specified at all, and I changed it to "Always trust", which changes all values as well. Then I: saved the change -> reconnect the iPad in my case, Xcode prepared the device for development and that's it.

    I changed the certificate settings back to "Use custom settings" and it keeps working also after device restart.

Add a Comment

Restarting my iPhone fixed this right away for me. IOS 15.1

Restarting the iPhone worked for me

  • iOS 15.4 and xcode version 13 in Devices shows Unable to prepare device for development, still not working after rebooting the iphone and xcode

Add a Comment

iOS 15.4 and xcode version 13 in Devices shows Unable to prepare device for development, still not working after rebooting the iphone and xcode

  • yep, +1 here, iOS 15.4. iPhone X and xcode 13.2.1. I also see the device in finder and able to sync, but it is failing to launch from xcode or terminal.

Add a Comment

I have the same problem with my iPad Pro and iPhone 13 (iOS 15.4) and Xcode 13.0. Multiple reboots failed to solve the problem. I even revoked and reissued my Developer Certificate. No joy. Help!

  • I solved the problem by upgrading to Xcode 13.3. I had 13.0 and was waiting for the app store to tell me to upgrade. I went to Open Developer Tools->More Developer tools to get the latest.

    Shame on Apple for not figuring out a better error message to tell people the app is out of date.

  • I had this problem, too. My MacBook is super old. I can't use anything passed XCode 13.2.1. Multiple reboots of Mac and phone failed to solve my problem. I revoked a few certificates, trusted others. Still nothing. In the end, I was able to work around this problem by just copying the build file directly onto the phone. So I build, open the Build Folder (from the XCode Build menu), then drag the app file onto the phone by loading the Device in the "Devices and Simulators" menu option, and dragging into there. My app appeared correctly on the phone. This might be the best I can do with my old MacBook.

  • How exactly do you navigate to the Build Folder with the app file? I also have an old Mac running Xcode 13.2.1.

Encountered same problem using Xcode 13.1 and an iPad Pro iOS 15.4 (just installed). Updating to Xcode 13.3 solved the problem for me.

note : The update took 2 hours for me. Use Activity Monitor to find the PID for installd, then use 'caffeinate -s -d -w ' to keep system and display up until the installd process finishes.

  • Thanks for this it really helped. I just had to upgrade Xcode to the most recent version. It's also important to mention that my phone was running on iOS 15.4.1

Add a Comment

I had this problem with the latest XCode 13.3.1. iPhone restart helped

  • Make sure you are not running over a VPN (for Mac and for device). I killed them, and it seems to work now.

Add a Comment