SwiftUI Previews in Xcode 14 failed to run with SettingsError: noExecutablePath(IDESwiftPackageStaticLibraryProductBuildable)

Hello :)

My iOS project does not work with SwiftUI Preview in Xcode 14 beta. The project builds and runs fine, but Preview never works. The error message is as follows.

HumanReadableSwiftError

SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060002ac3e880):'AppCenterCrashes'>)

I do use the AppCenterCrashes dependency in my project. But I'm not sure if this error message is accurate, because sometimes it reports other packages.

After I executed Generate Report, I found the following error in SerializationErrors.txt.

Error Domain=NSCocoaErrorDomain Code=516 "“LogCaffeineIntent.swift” couldn’t be linked to “Intermediates” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUserStringVariant=(
    Link
), NSDestinationFilePath=/var/folders/lv/58r5dhv52j779_qn41gnq4c80000gn/T/previews-diagnostics-20220608-144336/Intermediates/LogCaffeineIntent.swift, NSFilePath=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUnderlyingError=0x600033223810 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}

The problem seems to be related to the Intent generation code. I don't know how to fix it yet.

IDESwiftPackageStaticLibraryProductBuildable

Those long names are just painful

Hi,

Sorry to hear you are having problems getting previews working.

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.

If you are having issues with macOS, catalyst or on-device iOS previews then download and install the logging profile for your device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the bug report as well as the diagnostics using the instructions below.

Then when you get an error in Xcode Previews, an error banner appears in the canvas

  1. Click the "Diagnostics" button in that banner (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Im experiencing the same preview issue only in Xcode 14 beta, in Xcode 13 the preview works as it should.

HumanReadableSwiftError

SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x0000600040069f80):'MSAL'>)

The issue seems to be with this spm dependency that im using: https://github.com/AzureAD/microsoft-authentication-library-for-objc.git

I have tried to attach the generated diagnostics report as zip, however im not able to upload that here in this thread. So i have attached the previews_diagnostics_summary.txt.

Is this enough to investigate the problem?

Update: Once I removed AppCenter from the project, Previews worked fine. After a series of attempts, I found that the problem only occurs with a specific project structure.

// preview not work
MyApp
  - MyLib (swift package)
    - Lib1
    - Lib2 (add Lib1 as dependency)
      - AppCenterCrashes
      - AppCenterAnalytics
  - MainAppTarget (add Lib2 as dependency)

Thanks. The previews are also working for me if I remove the MSAL dependency (https://github.com/AzureAD/microsoft-authentication-library-for-objc.git) Im also having a spm structure like that with MSAL as dependency to different modules

It seems like xcode 14 has some problems with a few specific spm packages.

Confirmed that xcode 14 beta 2 still reproduces the problem.

Getting the same issue with Xcode 14 beta 2. The same view works in SwiftUI Previews without any problems in Xcode 13.

Confirmed that Xcode 14 beta 3 still reproduces the problem.

Removing type: parameter in package products helped me fix SwiftUI previews:

.library(
    name: "MyLib",
    // type: .static, 
    targets: ["MyLib"]
) 

In my case updating to Xcode 14 beta 4 solved that problem.

Xcode 14 Beta 4 **did not ** fix it for me, I am still seeing this issue

Me too. Xcode 14 beta 4 **did not ** fix it for me. Still seeing the issue.

This issue now appeared for me in Xcode 14 beta 4, was working fine in beta 1 and beta 2 (skipped beta 3).

HumanReadableSwiftError SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060000e50a4f0):'openssl-apple'>)

Filed as FB10909105, attached diagnostics that were produced along with sample project, which reproduces this issue.

Also experiencing this issue in beta 4.

Hola. eres desarrollador ios en Mexico ?

I finally solved the problem. I built binary XCFramework version of AppCenter, AppCenterAnalytics, AppCenterCrashes by myself. After using the XCFrameworks in Package.swift, SwiftUI Preview works properly.

        .binaryTarget(name: "AppCenter", path: "Carthage/Build/AppCenter.xcframework"),
        .binaryTarget(name: "AppCenterAnalytics", path: "Carthage/Build/AppCenterAnalytics.xcframework"),
        .binaryTarget(name: "AppCenterCrashes", path: "Carthage/Build/AppCenterCrashes.xcframework"),

It's still happening to me in beta 5.

Also Beta 5 with MSAL. Reported: FB11259530

I got a similar error trying to add a View to the sample code project for “Building a SignalGenerator”. 

(https://developer.apple.com/documentation/avfaudio/audio_engine/building_a_signal_generator)

I was using Xcode 13.4.1 and MacOS 12.5. The code runs i.e. produces audio successfully but with an error message “Previews not supported for SignalGenerator”

UnsupportedProductTypeError: Previews not supported for SignalGenerator

HumanReadableSwiftError CreationError: noBuildExecutor

Previews can be defined in applications, frameworks, Swift packages, or dynamic libraries productType = com.apple.product-type.tool buildable = SignalGenerator

Confirmed still happening to me in Beta 6.

This is working in beta 4 but broke in beta 6.

I can also confirm this is still a problem in Xcode 14 beta 6. My error report points to the same issue as what @Gong mentioned.

For me, this didn’t become an issue until beta 6

Same here with beta 6

I delete the package in Product -> Package dependencies to run the preview (and add again when building).. Does anyone have update regarding this issue ?

Started seeing this in 14 beta 6 as well


SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060001455b030):'Resolver-Static'>)
SwiftUI Previews in Xcode 14 failed to run with SettingsError: noExecutablePath(IDESwiftPackageStaticLibraryProductBuildable)
 
 
Q