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
23k views
  • Hola. eres desarrollador ios en Mexico ?

Add a Comment

Replies

Yup, the bug is -- unfortunately -- still present in Xcode 14.1 beta 1.

About AppCenter: See the issue https://github.com/microsoft/appcenter-sdk-apple/issues/2429

We tried with a fork to remove the static type information in the Package.swift. It's fixed. But we didn't try on MacOS platform, only iOS and tvOS.

We have also the same issue with a binary distribution of GoogleCastSDK-ios-no-bluethooth. The SwiftUI previews build consider the binary as a static library, as it's a dynamic one.

Add a Comment

Linking against a .dynamic type library fixes the SwiftUI preview breaking (well, at least for me) both on iOS and macOS

For example, linking against QRCodeDynamic (in my package.swift) :- 

.library(
   name: "QRCodeStatic",
   type: .static,
   targets: ["QRCode"]
),
.library(
   name: "QRCodeDynamic", 
   type: .dynamic, 
   targets: ["QRCode"]
)

the SwiftUI previews start working correctly. Linking against a static library type always fails. At least this is a workaround if you're stuck.

This also works if the type is not specified.

.library(
   name: "QRCode",
   targets: ["QRCode"]
),

But not a fix.

Linking against a .dynamic type library may fix the problem, but this is no guarantee. If looking a MSAL, it is defined without a type and thus should work if you trust the statements of some post here. But it does not :(.

  • Fair point. I hadn't tried with binary targets so was unaware of their status. Apologies.

Add a Comment

Hopefully this may help some of you. Im using Xcode 14.0

I had this same issue when building previews. I had added 2 swift packages via the built in spm in Xcode and was getting the error.

Removing them from the target -> Frameworks & Libraries solved the issue for me and the preview showed as expected and the product also built successfully.

Removing libraries is not a "fix". This is a pretty major issue to go into an actual release. Due to having Intercom in my project none of my SwiftUI previews work.

Anyone else have a valid fix for this Xcode 14 issue?

Issue still occurs with Xcode Version 14.1 beta 2 (14B5024i).

  • (accidentally added my reply as a comment)

Add a Comment

I had a similar problem (Previews not working after update to Xcode 14) but with different error messages saying that some of the types from frameworks were unavailable.

What solved it for me, is enabling Rosetta for Xcode 14.

If you have a M1 mac, right click the Xcode app, click on Information and then activate the checkbox "open with Rosetta". Restart Xcode 14.

Hope it helps.

I was getting the error in 14.1 beta 2, then I removed the package that was causing the error and re-added it back to my Xcode Project and everything started working.

I don't necessarily think that will solve anyones issue, but I suppose it's worth a shot.

I can confirm that Rosetta is not a cure-all here, as we have some dependencies that require us to run in Rosetta mode all the time and we still suffer from this issue.

14.1 Beta 3 resolved it for me. Have been having trouble with all 14-versions until now

  • I can confirm that this beta solves it so far

Add a Comment

Unfortunately, this is still an issue for me with 14.1 beta 3 [Xcode Version 14.1 beta 3 (14B5033e)]

HumanReadableSwiftError

SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x0000600032e3b4e0):'DSFToolbar'>)

FB11513131 has been updated with a new preview report

SadlyI also suffer from this - making previews totally unusable.

HumanReadableSwiftError

SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060001dbb4450):'GSSDKCore'>)

Yup, for me the problem still persist as well in 14.1 beta 3.

HumanReadableSwiftError
SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x0000600014106940):'AppCenterAnalytics'>)

Updated FB11515571 with new error report.

I am getting the following error:

HumanReadableSwiftError
SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060001242cf00):'MopinionSDK'>)