SwiftUI Preview on Device Error

Hey!

It is my second time asking for this recurring issue. I just downloaded Xcode 12.3, macOS 11.1, and iOS 14.3 on my device, and I am still getting the same error when I try to preview on my connected device:

Code Block bash
RemoteHumanReadableError: Failed to update preview.
Error encountered when sending 'display' message to agent.
==================================
|  RemoteHumanReadableError
|  
|  LoadingError: failed to load library at path "/private/var/mobile/Containers/Data/Application/08191EE1-B765-46B2-906E-A6E79A4D07FF//tmp/C4F99A38-6FF4-4394-BEB2-0095B3F6F3F2-ContentView.2.preview-thunk.dylib": Optional(dlopen(/private/var/mobile/Containers/Data/Application/08191EE1-B765-46B2-906E-A6E79A4D07FF/tmp/C4F99A38-6FF4-4394-BEB2-0095B3F6F3F2-ContentView.2.preview-thunk.dylib, 2): no suitable image found.  Did find:
|  /private/var/mobile/Containers/Data/Application/08191EE1-B765-46B2-906E-A6E79A4D07FF/tmp/C4F99A38-6FF4-4394-BEB2-0095B3F6F3F2-ContentView.2.preview-thunk.dylib: code signature invalid for '/private/var/mobile/Containers/Data/Application/08191EE1-B765-46B2-906E-A6E79A4D07FF/tmp/C4F99A38-6FF4-4394-BEB2-0095B3F6F3F2-ContentView.2.preview-thunk.dylib'
|  )

I even try with a blank SwiftUI project, and it is the same error message when I run a live preview on a device (Static previews, live previews, and build/run on device work fine).

I found some other people on the forum asking for the same bug, but none of them had answers to this problem.

I am running out of ideas on how to solve it, but I noticed that on line 8, it says ...7FF//tmp/..., while on line 9 says ...7FF/tmp/.... Not sure if it helps.

Diagnostics report

previews-diagnostics-20201214-101717 p.m..zip
https ://drive.google.com/file/d/1kLIgAnnpastfq3SenmQJC7D0Ph1G6SSW/view

(if you know a way to attach these reports in the forum please let me know)
I am still having this issue.
I don't know if it's a bug in Xcode or a bug with my account in Xcode
Same here with a lot of performance issues on previews
Debug console for previews also have stopped to work with Xcode 12 (worked fine with Xcode 11)
I develop on a MacBook Pro mi-2014
I’ve posted many questions/issues about Xcode 12 SwiftUI previews but no answer.
I wonder if I need a paid account to get some answer through this forum
So I’ve stopped to develop since I fed up with this release and to be ignored
Good luck
Same here, everything is working for me, but not the preview on a real device. I got the same error message. If anyone got an idea on how to fix it, please let us know.
I wasn't having this issue up until a couple weeks ago now none of my previews with Xcode 12.3 are working. I just get the following error when they attempt to render
Code Block
RemoteHumanReadableError: Failed to update preview.
The preview process appears to have crashed.
Error encountered when sending 'previewInstances' message to agent.
==================================
|  RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.)
|  
|  BSServiceConnectionErrorDomain (3):
|  ==BSErrorCodeDescription: OperationFailed


It's beyond frustrating.
I also have the same problem, everything works besides the physical device preview, same error. It is so frustrating.
@all: does the bug show with Xcode 12.2 (in simulator or on device running 14.3) ? From @VictorPuga OP, I understand the answer is yes.

Did you file bug reports ?
Sorry to hear you are having problems getting previews working. To start your app from a fresh slate you can use the terminal app and run xcrun simctl --set previews delete all.

If that still doesn't resolve issue then probably best next step will be to file a feedback with diagnostics.
We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.
  1. When you get an error in Xcode Previews, an error banner appears in the canvas

  2. Click the "Diagnostics" button in that banner

  3. In the sheet that appears, click "Generate Report" in the bottom left of the sheet

  4. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

I filed a feedback with diagnostics and sufficient descriptions on it some while ago (Mar 9, 2021 at 11:08 PMFB9037331). Still no answer. It is extremely frustrating and a timely answer would be really helpful now!
Any traction on this?

I'm seeing the identical error while working through the Landmarks tutorial.
SwiftUI Preview on Device Error
 
 
Q