Xcode 12.5 with iOS 14.5.1 device getting xcode failed to start remote service com.apple.debugserver on device

I have created a new project and running the project on iOS 14.5.1 device with Xcode 12.5. But it is showing an error saying "Xcode failed to start remote service com.apple.debugserver on device"

I have tried all the below options
  • Unpaired, paired the device.

  • Restarted device.

  • Restarted Xcode, Mac system.

Notes:
  • If I run the app in the device by disabling (Edit Scheme -> Info -> Debug Executable) options then it is working fine, but I can't debug with this option.

  • If I run the app in the simulator in debug mode by enabling Debug Executable option then it is working fine.



Answered by abattula in 675218022
Finally, I found the solution for this after performing the below steps
  1. After installing Xcode12.5 in macOS Big Sur. Check the CommandLineTools folder are available in Developer folder by executing this command cd /Library/Developer. By using xcode-select --install command we can install CommandLineTools for the xcode.

  2. I am using company provided MacBook Pro. So after executing xcode-select --install command, got network problem error, this is because installation server configuration is different. By using this answer i am able to successfully install the CommandLineTools

  3. I am using iOS14.5.1 device. So in this path Applications -> Xcode(right click and select show packget contents) -> Contents -> Developer -> Platforms -> iPhoneOS.platform -> DeviceSupport -> renamed 14.5 folder name to 14.5.1

  4. Now i quit Xcode, disconnected iphone.

  5. Reconnected iPhone with mac. Opened Finder app, here it is asking to Trust the iphone. After clicking on trust button i got some error. this error because of McAfee software security check. i have disabled that by following steps in this link

  6. Now i quit Xcode, disconnected iphone. Reconnected iPhone, opened xcode. Click on trust in prompt in both Finder -> iphone device name folder, iPhone device

  7. After some time it is successfully paired the device. Navigate to Library -> Developer -> Xcode -> iOS DeviceSupport -> 14.5.1 (18E212) arm64e -> check info.plist file, symbols folder available. If these files are avaible then our device is successfully paired with mac system and it is ready for debugging.

  8. Now debugging is working fine successfully.

Same trouble on OSx 11.3.1 Xcode 12.2 (12B45b) on Simulator with iOS 14.2
Apple, please fix this bug. It restricts debugging during development. it's critical issue.
Adding few more details:

When I am inspecting the code got the below errors with the mobile app SFSafariViewCotroller and the required content is not loading, but it is working fine with mobile, desktop Safari browsers and not showing any errors.
  • Refused to load {URL://_csrfRefresh=1} because it does not appear in the frame-ancestors directive of the Content Security Policy.

  • Sandbox access violation: Blocked a frame at {URL} from accessing a cross-origin frame. Ther being accessed is sandboxed and lacks the "allow-same-origin" flag

Here I am unable to attach the screenshot. So adding stackover link for reference

I am using the below code to load the URL in SFSafariViewControl


Code Block
@IBAction func launchSafariVC(_ sender: Any) {
    if let url = URL(string: "url string") {
      let config = SFSafariViewController.Configuration()
      config.entersReaderIfAvailable = true
      let vc = SFSafariViewController(url: url, configuration: config)
      present(vc, animated: true)
    }
  }


Accepted Answer
Finally, I found the solution for this after performing the below steps
  1. After installing Xcode12.5 in macOS Big Sur. Check the CommandLineTools folder are available in Developer folder by executing this command cd /Library/Developer. By using xcode-select --install command we can install CommandLineTools for the xcode.

  2. I am using company provided MacBook Pro. So after executing xcode-select --install command, got network problem error, this is because installation server configuration is different. By using this answer i am able to successfully install the CommandLineTools

  3. I am using iOS14.5.1 device. So in this path Applications -> Xcode(right click and select show packget contents) -> Contents -> Developer -> Platforms -> iPhoneOS.platform -> DeviceSupport -> renamed 14.5 folder name to 14.5.1

  4. Now i quit Xcode, disconnected iphone.

  5. Reconnected iPhone with mac. Opened Finder app, here it is asking to Trust the iphone. After clicking on trust button i got some error. this error because of McAfee software security check. i have disabled that by following steps in this link

  6. Now i quit Xcode, disconnected iphone. Reconnected iPhone, opened xcode. Click on trust in prompt in both Finder -> iphone device name folder, iPhone device

  7. After some time it is successfully paired the device. Navigate to Library -> Developer -> Xcode -> iOS DeviceSupport -> 14.5.1 (18E212) arm64e -> check info.plist file, symbols folder available. If these files are avaible then our device is successfully paired with mac system and it is ready for debugging.

  8. Now debugging is working fine successfully.

Xcode 12.5 with iOS 14.5.1 device getting xcode failed to start remote service com.apple.debugserver on device
 
 
Q