Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SwiftUI / Xcode Error - Updating took more than 5 seconds

Tags:

xcode

swiftui

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)

like image 347
MattBlack Avatar asked Apr 02 '20 09:04

MattBlack


People also ask

Why does it take so long to update Xcode?

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).

How to fix previewupdatetimedouterror in Xcode?

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.

How to find the error message when your Xcode app crashes?

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.

Why is my SwiftUI previews not working?

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.


1 Answers

In my case the issue was this line in Build settings:

enter image description here

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.

like image 199
msmialko Avatar answered Sep 21 '22 10:09

msmialko