Xcode error: Failed to prepare device for development

IosIphoneXcodeBetaXcode12

Ios Problem Overview


I have updated to Xcode 12.3 beta. device version is 14.2, but Xcode complaining:

> Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window. > > Failed to prepare device for development

iPhone directly connected to MacBook. I have tried all mumbo jumbos on the web. but no success any idea?

enter image description here

> Unable to prepare DEVICE for development > > Please check the connection to the device, and review all errors in the Devices and Simulators window.

Ios Solutions


Solution 1 - Ios

A simple phone restart will fix it

I have had to come back to this SO question twice in the past couple weeks. First time, I did have to update my Xcode and iOS versions, which fixed the issue. Now, the issue has returned, but there are no updates. I tried disconnecting and reconnecting my phone from my laptop, but to no avail.

What fixed it the second time was merely restarting my phone. I am curious if that would have fixed it the first time too, without needing to have updated.

I know this is just echoing the other answers here, but at the very least, I would recommend just starting with a simple phone restart and seeing if that fixes your problem. Here is the specific screenshot that I encountered, in case yours is the same (pro tip: you can open up the "Devices and Simulators" window by going to Window -> Devices and Simulators shift-command-2).

Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window

Solution 2 - Ios

Exact same problem here, this solved the issue for me:

  • Delete the app from the phone
  • Clean the Build Folder with: + shift + K
  • Delete derived data
  • Unpair device (from + shift + 2 window)
  • Disconnect iPhone
  • Restart iPhone
  • Restart Mac
  • Trust

After this, it worked for me.

Solution 3 - Ios

This error shows because of iPhone OS version is not supported by Xcode that's why this warning popped up, so check which max ios version is supported by Xcode which you are using.

In my case, the Xcode version is 13.1 and my iOS version is 15.4 so what I did, First downloaded device support version 15.4 from here (Download according to your device version) and added this to my Xcode.

steps to add the file in Xcode:-

  1. Go to Applications > Right click on Xcode and Select Show Package Contents > Contents > Developer > Platforms > iPhoneOS.platform > DeviceSupport.

  2. Extract your device support file to DeviceSupport Folder.

  3. Restart Xcode and unplug and plug in your device.

Solution 4 - Ios

I restarted my iPhone(14.2); now both Xcode 12.3 beta and 12.2 can run app on my device.

Solution 5 - Ios

I could not get the phone to authorize until I had the paired Apple Watch trust the computer as well. A more helpful error message could be imagined.

Both the iPhone and the paired Apple Watch must trust the computer before the phone can be successfully prepared for development.

Solution 6 - Ios

In my case was to keep the iOS version with my Xcode version in sync.

Xcode 12.3 with iOS 14.3

Solution 7 - Ios

Thanks Matt for hint: Updating device iOS to 12.3 beta fixed the problem.

if you updated you iOS to latest beta version, you should also use latest Xcode beta version.

Solution 8 - Ios

What worked for me was to go to Xcode Devices and Simulators window, then ...

  • right click on the Connected device, and select "Show Provisioning Profiles" menu item, then delete all the provisioning profiles,
  • right click on the Connected device, and select "Unpair Device" menu item
  • Unplug and reboot the phone

Solution 9 - Ios

I tried most suggestions here. The only thing that ended up working was unpairing my phone in Xcode then unpairing my apple watch from my iPhone. Connects just fine now. iOS (14.3) Xcode (12.3)

Solution 10 - Ios

Exact the same problem with Xcode 12.3 beta ; for me, just have to: Disconnect the phone Restart the phone still on ios14.2

Solution 11 - Ios

-> data cable off

-> data cable on

and it works :)

Solution 12 - Ios

Solution: Update your Xcode to a newer release date than your iOS Release Date.

Solution 13 - Ios

I experienced this problem when using the iPhone's personal hotspot on my Mac. The fix was to disconnect the phone from the computer, then disconnect from the personal hotspot and reconnect again. Apparently this makes the mac use the wifi hotspot (and not the usb hotspot on the iPhone, which messes things up when debugging).

Solution 14 - Ios

As many people mentioned/suggested, restarting my iPhone solved the problem.

My setups are: Catalina 10.15.7, Android Studio 4.0, Flutter 2.01,and Xcode 12.4.

Solution 15 - Ios

I think having an apple watch paired to your iphone causes some issues.

I had trusted from my apple watch, but was still having this issue. Unparing my apple watch from my iphone was the only thing that worked for me:

  • unpair apple watch from iphone
  • unpair iphone from xcode

Restart both, and don't pair apple watch until the iphone is paired.

and, if you have any other problems, and are using flutter, run flutter doctor, and ensure you have cocoapods installed.

and once again, if Flutter issues, follow the details here to ensure you have your signing setup correctly

also, if things aren't working, then do a flutter clean, and then try again.

Solution 16 - Ios

I just solved my issue removing the iPhone cable and putting it back.

Solution 17 - Ios

This solved the issue for me:

  • Delete the app from the phone
  • Clean the Build Folder with: + shift + K
  • Unpair device + shift + 2
  • Disconnect iPhone

Solution 18 - Ios

Updating Xcode is a fix because old versions of Xcode can't talk to new versions of iOS (see https://developer.apple.com/support/xcode/ for compatibility).

If you're stuck on an old version of Xcode you can use something like https://github.com/iGhibli/iOS-DeviceSupport or https://github.com/filsv/iPhoneOSDeviceSupport which installs the newer device support files into older versions of Xcode.

Solution 19 - Ios

Nothing from the above listed helped me and also I have encountered this problem when the app was removed for a while. But turning off the phone for 10 mins solved the problem.

Solution 20 - Ios

My Current Setting and Versions: XCode 12.4 and iOS 14.4

  • I had to update XCode since my iOS was updated. This fixed the compiler error in Unity and then the same message popped up during deployment. All I did was disconnect/re-connect.

Solution 21 - Ios

Restarting the iPad works for me every time!

Solution 22 - Ios

I just had to unpair the phone from Xcode's Devices and Simulators screen and then tap Trust when connecting it to the computer to make my Watch work with Xcode

Solution 23 - Ios

  1. cmd + shift + 2
  2. Click the red cross to check error detail
  3. In most cases, the error message shows your xcode supported iOS version is lower than your iPhone's iOS version.
  4. Update your xcode.

Solution 24 - Ios

In my case, after updating iPhone to a newer iOS version then got this issue.

The solution is needed to update XCode to the latest version and everything is ok.

Solution 25 - Ios

I had to change the iOs Deployment target to "iOs 15". Then it worked. After that, I just set it back to iOS 12, and everything keeps working.

Solution 26 - Ios

If nothing worked for you, try the below steps.

  • Update the Xcode
  • Update the iOS version
  • Connect mac and iPhone to the same wifi

Solution 27 - Ios

just Clean the Build Folder with: ⌘ + shift + K

Solution 28 - Ios

I got it resolved today by upgrading OS on my Mac to 12.3.1 and Xcode to 13.3.1 as well as restarting and re-connecting devices couple of times.

Solution 29 - Ios

In my case solution was:

  • General settings on phone device
  • Profiles & Device Management
  • Open developer app and click on Trust

Solution 30 - Ios

I got the same error message after updating Xcode to 12.4. I have disconnected and reconnected iPad. Then, I have waited for 1 or 2 minutes for Xcode to process device's cache files. Finally, I could run my application in device.

Solution 31 - Ios

For me, it was a "Trust" issue, where in the past, after the long build process, finally XCode would try to install on the phone, and by then it would have forgotten that I selected to "trust" the mac (on the phone), and give some error message that I needed to disconnect and reconnect the phone to run the app on it. This was with earlier versions of Xcode.

This time, with Xcode 12.3, that error message didn't show up, but instead, got this unhelpful generic error message. I had selected to trust the Mac earlier, but I think because of the long build process, and the machine went to sleep during that time, then the Mac "forgot" that I had chosen to trust it. The next time, I disconnected and reconnected the phone, selected "trust" again, and babysat the phone to stay awake while the re-build was happening. Then it worked.

I didn't have to reboot the phone or mac or even restart Xcode.

Solution 32 - Ios

I found that if the device is in "Low Power Mode" it would result in this error. So just deactivate it in your settings.

Solution 33 - Ios

Running Xcode 12.4 and iOS 14.4 on an iPhone Xs and ran into same issue today. First time I've seen it. I wanted to echo what many of the other contributors here have already indicated; rebooting the iOS device did the trick.

Solution 34 - Ios

We encountered this error and determined it was due to a damaged iPhone cable. New cable, problem solved.

Solution 35 - Ios

The steps below, work for me :D

  • Delete the app from the phone
  • Clean the Build Folder with: ⌘ + shift + K
  • Delete derived data
  • Unpair device (from ⌘ + shift + 2 window)
  • Disconnect iPhone
  • Restart iPhone
  • Restart Mac
  • Trust

Thanks !!!

Solution 36 - Ios

devices and simulators view

Me help is set mark radio "connect via network" (on the top right devices and simulators menu)

Solution 37 - Ios

I faced the same on my iPhone running iOS 15.0 while trying to run my app from Xcode 13.0, killing the UBS demon helped me, no restart was required.

sudo killall -STOP -c usbd 

More from Apple Developer Forum.

Solution 38 - Ios

I had the same issue and tried all the other suggested fixes:

  • Cleared Derived Data
  • Xcode clean/restart
  • Removed paired device
  • Restart device
  • Restart Mac
  • Trust the computer on both Device and Apple Watch again

In the end the only thing that worked for me was to update my paired Apple Watch Series 3 to the latest OS version.

Solution 39 - Ios

After Mac and iPhone rebooting, if you have Apple Watch - wear them and input trust code or even reboot them.

Solution 40 - Ios

What helped me after phone restart is, on the phone:

  1. Go to settings
  2. Developer
  3. Forget trusted devices (its the first button)
  4. Reconnect the phone to the mac
  5. Click trust on the phone
  6. Exit settings(otherwise it will say that your phone is busy)
  7. Click that play button in XCode

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHashem AboonajmiView Question on Stackoverflow
Solution 1 - IosAaron KraussView Answer on Stackoverflow
Solution 2 - IosBence PattogatoView Answer on Stackoverflow
Solution 3 - IosRajni GujaratiView Answer on Stackoverflow
Solution 4 - IoscloudqqView Answer on Stackoverflow
Solution 5 - IosDrSmartView Answer on Stackoverflow
Solution 6 - IosFBCView Answer on Stackoverflow
Solution 7 - IosHashem AboonajmiView Answer on Stackoverflow
Solution 8 - IosTacheView Answer on Stackoverflow
Solution 9 - IosLittleChewbaccaView Answer on Stackoverflow
Solution 10 - IosdavidView Answer on Stackoverflow
Solution 11 - IosHaseeb JavedView Answer on Stackoverflow
Solution 12 - IosBreno Medeiros de OliveiraView Answer on Stackoverflow
Solution 13 - IosSean GoudarziView Answer on Stackoverflow
Solution 14 - IosdwchoView Answer on Stackoverflow
Solution 15 - IosBrad ParksView Answer on Stackoverflow
Solution 16 - IosBruno RamosView Answer on Stackoverflow
Solution 17 - IosSagittariusView Answer on Stackoverflow
Solution 18 - IostschumannView Answer on Stackoverflow
Solution 19 - IosNikolai ProkofevView Answer on Stackoverflow
Solution 20 - IosSauView Answer on Stackoverflow
Solution 21 - IosAhmed FathiView Answer on Stackoverflow
Solution 22 - IosbudiDinoView Answer on Stackoverflow
Solution 23 - IosLouis LiangView Answer on Stackoverflow
Solution 24 - IosBinh HoView Answer on Stackoverflow
Solution 25 - Iosuser1383029View Answer on Stackoverflow
Solution 26 - IosSamView Answer on Stackoverflow
Solution 27 - Iosislam XDeveloperView Answer on Stackoverflow
Solution 28 - Iosmarika.dabojaView Answer on Stackoverflow
Solution 29 - IosHaris DautovićView Answer on Stackoverflow
Solution 30 - IosAybek Can KayaView Answer on Stackoverflow
Solution 31 - Iosauspicious99View Answer on Stackoverflow
Solution 32 - IosChill MellomView Answer on Stackoverflow
Solution 33 - IosDaniel DrouhardView Answer on Stackoverflow
Solution 34 - IosMKDevView Answer on Stackoverflow
Solution 35 - IosLuciano FerreiraView Answer on Stackoverflow
Solution 36 - IosСтепан ТурченкоView Answer on Stackoverflow
Solution 37 - IosSauvik DoluiView Answer on Stackoverflow
Solution 38 - IosAlex AstileanView Answer on Stackoverflow
Solution 39 - IosLeonifView Answer on Stackoverflow
Solution 40 - IosDirtyFredView Answer on Stackoverflow