When I try to preview one of my views in the canvas I keep getting the following error:
PreviewUpdateTimedOutError: Updating took more than 5 seconds
All my other views load perfectly fine.
Why is this happening and how do I resolve?
I am using SwiftUI in Xcode 11.4 (public release)
As of XCode 12.5.1, the message PreviewUpdateTimedOutError: Updating took more than 5 seconds most likely means that your app crashed and thus updating the preview failed. The real reason for the crash is unfortunately obscured by this useless message (why Apple would do that is beyond me).
Try Clean (Shift + ⌘ + K) and Build (⌘ + B) to build again the SwiftUI project, it works in Xcode 11.6. Try building a basic hello world app. Show activity on this post. As of XCode 12.5.1, the message PreviewUpdateTimedOutError: Updating took more than 5 seconds most likely means that your app crashed and thus updating the preview failed.
After the crash, go to Xcode in the lower right hand pane, scroll all the way to the top. So now that you know how to find the actual error message when your app crashes, the next step is to learn to recognize some of the more common types of messages because they will hint at what’s wrong.
Show activity on this post. Something I did accidentally changed signing settings in my project. Specifically, "signing identity" was set to "Sign to Run Locally.". For some reasons, SwiftUI Previews don't work then. Simply deleting this line from build settings (aka setting default value) solved the problem. Show activity on this post.
In my case the issue was this line in Build settings:
Something I did accidentally changed signing settings in my project. Specifically, "signing identity" was set to "Sign to Run Locally.". For some reasons, SwiftUI Previews don't work then.
Simply deleting this line from build settings (aka setting default value) solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With