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.

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).

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

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'>)

Still seeing this on Xcode 14.0.1


SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060002d71f930):'PhraseSDK'>)

I'm using AppCenter and MSAL with SPM, and I managed to solve the issue.

First I tried the local package idea suggested above but that didn't solve anything.

AppCenter is rolling a fix (which at the moment of writing this isn't merged yet): https://github.com/microsoft/appcenter-sdk-apple/pull/2433 Their fix is to remove the hardcoded library type from their Package.swift.

For MSAL, they don't have this hardcoded setting, so I'm not sure what exactly causes the issue. But gladly on Xcode 14.1 beta 3 (14B5033e), using MSAL via SPM won't cause the error anymore.

So a solution for me was to pin AppCenter to that branch + use Xcode 14.1 beta.

sigh Still an issue in the Xcode 14.1 release. Exhausting.

I found that if any of the SPM packages using binary dependencies the preview will fail.

if my case it was a local Package with Firebase Binaries

    targets: [
		.binaryTarget(name: "FirebaseAnalytics", path: "Frameworks/FirebaseAnalytics/FirebaseAnalytics.xcframework"),

After I removed the local package with binaries I can finally see my preview.

Xcode 14.1 fixed that issue for me (After 2 month) 🙏🏽

Still seeing this issue with Xcode 14.1 and the library "ProgressHUD".

SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060000bec3ba0):'ProgressHUD'>)

An issue has been logged with the offending package, but this used to work without changes needed in the package.

Maybe removing type: .static is all that is needed there too? (Like was done here.)

I followed Microsoft's approach with my own libraries and removed the library type(s) from the Package.swift file and the issue 'goes away'. Hopefully this reduces the bug reports coming in stating that my library has 'broken' SwiftUI.

However, this is purely a workaround of the issue and not a solution. Some clients want to explicitly define their library usage and for them the Xcode bug persists.

If this is somehow my problem (ie. I'm using SPM incorrectly) then it would be awesome to understand how to fix it (especially since Xcode 13 didn't have this issue).

Xcode 14.2 seems to have fixed this for my case w/ conditional SPM dependencies for !APPLE platforms. Closing FB11511342 then.

Xcode 14.2 appears to have resolved this issue for my apps - I'm being slightly optimistic on this version! Both my macOS and iOS targets now correctly show SwiftUI previews without erroring anymore.

Will keep testing...

I am also happy to report that I can again use SwiftUI previews with Xcode 14.2.

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