Hi everyone, I'm encountering an issue when trying to run Xcode Previews for my HelloWorldApp on a real iPhone device. The app fails to install, and I get the following error message:
Development Environment:
Xcode Version: 16C5032a
macOS Version: 23H420
Test Device (iPhone): iPhone 12 mini, iOS 15.5 (19F77)
MacBook: MacBook Air (M1, arm64e)
Error Message:
Whenever I attempt to preview the app using SwiftUI Previews on my iPhone (iPhone của Định), I get the following installation error:
FailedToInstallAppError: Failed to install ”HelloWorldApp.app”
Could not install the preview host ”HelloWorldApp.app” on iPhone của Định
Here’s part of the detailed log: agentBundle = com.DihNgx.HelloWorldApp { url: file:///Users/dihngx/Library/Developer/Xcode/DerivedData/HelloWorldApp-eyeszqttvaydocbdmoiwcczlazrt/Build/Intermediates.noindex/Previews/iphoneos/HelloWorldApp/Products/Debug-iphoneos/HelloWorldApp.app signingInformation: Code Signing { identifier: com.DihNgx.HelloWorldApp identity: A9A830FA23874E2047C974D6621D441EB9CBC7CC hasGetTaskAllow: true isSandboxed: false } }
Device Information:
Device Name: iPhone của Định Device Identifier: 00008101-001C482922C0001E iOS Version: 15.5 Provisioning profile installed: "iOS Team Provisioning Profile: com.DihNgx.HelloWorldApp"
Steps I’ve already tried (but the issue persists):
Ensured that Xcode recognizes the iPhone and that the device is connected properly. Checked Code Signing and Provisioning Profile (no issues were shown). Cleaned the build folder (Cmd + Shift + K) and deleted Derived Data. I’d really appreciate any advice or suggestions on how to solve this issue. Has anyone else faced a similar error or knows how to fix this? Thanks so much in advance!
Hi,
Sorry to hear you are having problems getting on-device previews working. This error can often indicate an issue with the signing profiles. Could you try first doing a build+run targeting the iOS device and see if Xcode is able to install and launch the app?
Once that works, try the preview again. If it is still failing then the best next step will be filing a feedback with diagnostics so we can take a look.
We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.
Install the logging profile using instructions available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift On your mac running Xcode, and on your physical preview device (if you are using one).
Install the logging profile using the following instructions on your mac running Xcode; and if you are using one, your physical preview device (iOS or visionOS): https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
Then when you reproduce the problem in Xcode:
- Either (a) an error banner will appear, click the "Diagnostics" button in that banner; or (b) if you're not seeing an error but you still want to provide diagnostics you can get the same diagnostics window by going under the Editor menu in the menu bar, then selecting the Canvas submenu, then selecting "Diagnostics".
- In the sheet that appears, click "Generate Report" in the bottom left of the sheet
- Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
- Generate a sysdiagnose on your mac and any on-device preview devices, and attach those too