sparkle-project / Sparkle

A software update framework for macOS
https://sparkle-project.org
Other
7.41k stars 1.05k forks source link

SwiftUI canvas previews in Xcode break when Sparkle is added a dependency in a multiplatform app #2558

Closed Suges closed 4 months ago

Suges commented 4 months ago

Hi there,

I just added Sparkle to the macOS target of my multiplatform app.

Description of the problem

If you have a multiplatform app (as described here: https://developer.apple.com/documentation/xcode/configuring-a-multiplatform-app-target), where one platform is macOS (not Catalyst), and the others are any of iOS/tvOS/watchOS/visionOS, everything works fine, previews fine, and builds fine when you're on the macOS destination.

When you switch to one of the other destinations, the Preview Canvas always fails with this error:

While building for iOS Simulator, no library for this platform was found in '/Users/.../SourcePackages/artifacts/sparkle/Sparkle/Sparkle.xcframework'.

(note "iOS Simulator" will switch to, say, "tvOS Simulator" if you're on that destination, and so on)

In the project's settings, General tab, Frameworks, Libraries, and Embedded Content heading, the Sparkle library's Filter is set to macOS (not Always Used).

It does look to me like some kind of problem with Xcode itself, i.e. the Preview Provider is trying to build a preview incorporating a library it shouldn't be, but I'm just bringing the issue here to be sure.

I just want to repeat: this is only a problem with SwiftUI previews. All my app destinations build just fine, and Sparkle works just fine in production on the macOS destination.

Do you use Sandboxing in your app?

Yes

Version of Sparkle.framework in the latest version of your app

2.6.2

Steps to reproduce the behavior

  1. Create a new Xcode multiplatform SwiftUI-based project
  2. Add a Mac and iOS destination
  3. Add Sparkle as an SPM depency
  4. Switch the destination to an iOS platform such as "iPhone 15"
  5. Open the default ContentView in the editor (with the Canvas turned on if it isn't already)
  6. The Preview will crash immediately
zorgiepoo commented 4 months ago

Please file a bug report to Apple via Feedback Assistant and attach a sample project and crashlog (from Console app) if available onto that report. I don't see how this is an issue on Sparkle's end to address. If you do this, feel free to attach the feedback report ID you reported over here.

Suges commented 4 months ago

I've never gotten a response in my life in 15 years of sending Feedback through the Assistant, but here goes!

FB13790171

zorgiepoo commented 4 months ago

Things get occasionally resolved but they need to be aware of issues. The multi-platform with Sparkle workflow you are using used to not even be possible (see #2330), so that is progress. Closing this issue as it's not actionable over here. Thanks for filing.

zorgiepoo commented 3 months ago

This may be fixed in the Xcode 16 beta.

Suges commented 3 months ago

Looks like it is! I can't believe that Feedback worked!