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.

Post not yet marked as solved Up vote post of Gong Down vote post of Gong
985 views

Replies

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)
  • Uploaded previews-diagnostics to FB10118238. (The attachment is not shown in the Feedback Assistant, so I'm not sure if it was uploaded successfully. 🤔)

Add a Comment

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.

  • Thanks for providing the information too! I've tried a lot of different combinations, but haven't found a pattern yet. Also haven't found a specific problem from Microsoft's SPM package. I'll come back later when I have a follow-up update :)

Add a Comment

Confirmed that xcode 14 beta 2 still reproduces the problem.

Post not yet marked as solved Up vote reply of Gong Down vote reply of Gong

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.

Post not yet marked as solved Up vote reply of Gong Down vote reply of Gong

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

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