Xcode 12 beta SwiftUI Canvas failing to show View

Code Block
RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.)
BSServiceConnectionErrorDomain (3):
==BSErrorCodeDescription: OperationFailed


This is the error I'm getting from the Canvas diagnostics.
Ah found the crash log.. here's the error I'm getting:


Code Block language
Fatal error: attempting to create attribute with no subgraph: External<AnyView>: file /Library/Caches/com.apple.xbs/Sources/AttributeGraph_Sim/AttributeGraph-67.1/api/Attribute.swift, line 430


Same issue here, have yet to get Xcode previews to not crash on device.
same here.

Code Block
Fatal error: attempting to create attribute with no subgraph: CachedView<PageViewController, UUID>: file /Library/Caches/com.apple.xbs/Sources/AttributeGraph/AttributeGraph-67.1/api/Attribute.swift, line 430

I'm having the same issue. Also trying to preview the PageViewController. I had to run on the simulator to see the result.
  • 1 for this, haven't been able to figure out a cause. Previews actually seem to work most of the time, but will randomly break and I'll see this error.

I just encountered the same issue. I had forgot to add the .environmentObejct(...) to the previews section, hence the preview couldn't update due to a missing connection to the data.
Also got it fixed by adding the environment to my preview



I could solve this problem by going to Window > Devices and Simulators, then choosing the Device that runs into this error and
deleting the paired Apple Watch. After that previews were created in the expected time. In my case, I do not need the paired Apple Watch, so this solution works for me for now.
I ran into this on Xcode 12 Beta on Big Sur while following the SwiftUI tutorial: https://developer.apple.com/tutorials/swiftui/handling-user-input.

The fix that worked was to add .environmentObject on the preview.

Before:
Code Block
struct LandmarkDetail_Previews: PreviewProvider {
  static var previews: some View {
    LandmarkDetail(landmark: landmarkData[0])
  }
}


After:
Code Block
struct LandmarkDetail_Previews: PreviewProvider {
  static var previews: some View {
    LandmarkDetail(landmark: landmarkData[0])
      .environmentObject(UserData())
  }
}

Xcode 12 beta SwiftUI Canvas failing to show View
 
 
Q