SwiftUI preview : PropertyListError: Property list missing value for required key "binaryType"

Hello,

SwiftUI previews are not working in my project : when I try to display the preview in Xcode, I got this error :

And if I click on the help icon, here is the complete error message :

RemoteHumanReadableError: Invalid preview service message on ServiceHub channel

==================================

|  RemoteHumanReadableError
|  
|  PropertyListError: Property list missing value for required key ”binaryType”
|  Property list: ["agentRole": previews, "environment": {
|      "DYLD_FRAMEWORK_PATH" = "/Users/alexandrecools/Library/Developer/Xcode/DerivedData/MyProject-gqsbendjcwgnvygdhqcoqqznoijh/Build/Intermediates.noindex/Previews/PreviewTesting/Products/Debug-iphonesimulator";
|      "DYLD_LIBRARY_PATH" = "/Users/alexandrecools/Library/Developer/Xcode/DerivedData/MyProject-gqsbendjcwgnvygdhqcoqqznoijh/Build/Intermediates.noindex/Previews/PreviewTesting/Products/Debug-iphonesimulator";
|      "OS_ACTIVITY_DT_MODE" = YES;
|      "PACKAGE_RESOURCE_BUNDLE_URL" = "/Users/alexandrecools/Library/Developer/Xcode/DerivedData/MyProject-gqsbendjcwgnvygdhqcoqqznoijh/Build/Intermediates.noindex/Previews/PreviewTesting/Products/Debug-iphoneos";
|      "SQLITE_ENABLE_THREAD_ASSERTIONS" = 1;
|      "XCODE_RUNNING_FOR_PREVIEWS" = 1;
|      "__XCODE_BUILT_PRODUCTS_DIR_PATHS" = "/Users/alexandrecools/Library/Developer/Xcode/DerivedData/MyProject-gqsbendjcwgnvygdhqcoqqznoijh/Build/Intermediates.noindex/Previews/PreviewTesting/Products/Debug-iphonesimulator";
|      "__XPC_DYLD_FRAMEWORK_PATH" = "/Users/alexandrecools/Library/Developer/Xcode/DerivedData/MyProject-gqsbendjcwgnvygdhqcoqqznoijh/Build/Intermediates.noindex/Previews/PreviewTesting/Products/Debug-iphonesimulator";
|      "__XPC_DYLD_LIBRARY_PATH" = "/Users/alexandrecools/Library/Developer/Xcode/DerivedData/MyProject-gqsbendjcwgnvygdhqcoqqznoijh/Build/Intermediates.noindex/Previews/PreviewTesting/Products/Debug-iphonesimulator";
|  }, "__unique_service_message_identifier": 4, "deviceEnvironment": {
|      "SIMULATOR_CAPABILITIES" = "/Applications/Xcode 14.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/DeviceTypes/iPhone 14 Pro Max.simdevicetype/Contents/Resources/capabilities.plist";
|      "SIMULATOR_DEVICE_NAME" = iPhone4Simulator;
|      "SIMULATOR_LEGACY_ASSET_SUFFIX" = iphone;
|      "SIMULATOR_MAINSCREEN_HEIGHT" = 2796;
|      "SIMULATOR_MAINSCREEN_PITCH" = "460.000000";
|      "SIMULATOR_MAINSCREEN_SCALE" = "3.000000";
|      "SIMULATOR_MAINSCREEN_WIDTH" = 1290;
|      "SIMULATOR_MODEL_IDENTIFIER" = "iPhone15,3";
|      "SIMULATOR_PRODUCT_CLASS" = D74;
|  }, "agentIdentifier": {
|      bundleID = "com.apple.dt.XCPreviewAgent";
|      discriminant = bundleID;
|  }, "displaySize": {
|      height = 932;
|      width = 430;
|  }, "deviceIdentifier": com.apple.CoreSimulator.SimDeviceType.iPhone-14-Pro-Max, "processType": application, "arguments": <__NSArray0 0x1b9e04f48>(
|  
|  )
|  , "workspaceID": E4CEE565-58C6-4EB5-94F1-7A9F48791515, "deviceType": simulated, "payloadUsedAgentIdentifier": 1, "frameBufferMaskPath": /Applications/Xcode 14.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/DeviceTypes/iPhone 14 Pro Max.simdevicetype/Contents/Resources/framebuffer.pdf, "displayScale": 3, "bundleID": com.apple.dt.XCPreviewAgent]

==================================

|  MessageSendFailure: Message send failure for <ServiceMessage 4: relaunch>

Is there anyone who already encountered this error message? Or maybe anyone who have any idea how to solve it?

Thanks,

Alexandre

Hi,

Sorry to hear you are having problems getting previews working. This is not an issue that we currently have any bug reports for so the best next step will be for you to file a feedback with diagnostics so we can take a look.

Steps to generate helpful diagnostics:

  1. Download and install the logging profile on all devices involved. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
  2. Reproduce the issue
  3. Click the "Diagnostics" button in the error banner in Previews' Canvas area (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too
SwiftUI preview : PropertyListError: Property list missing value for required key "binaryType"
 
 
Q