Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
164 stars 142 forks source link

[Bug]: Previews not working on Xcode 14.X #349

Closed knellr closed 1 year ago

knellr commented 1 year ago

Platform

iOS

Platform Version

N/A

Braze SDK Version

4.5.0

Xcode Version

Xcode 14.X

Integration Method

Swift Package Manager

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

Expected Behavior

Preview works as it did on Xcode 13.X

Actual Incorrect Behavior

HumanReadableSwiftError SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060002d064ba0):'AppboyKit'>)

Verbose Logs

No response

Additional Information

The issue appears to be discussed here: https://developer.apple.com/forums/thread/707569 and relates to the AppBoyKit product being set to .static explicitly.

We use Swift packages extensively including some of our own modules, but we don't have the setup described in the thread above.

giljobs commented 1 year ago

me too 😭 , with same error.

hokstuff commented 1 year ago

Hi @knellr,

Looking through the attached thread, it sounds like the issues here are related to how the Previews in Xcode 14 interface with some (static) libraries. Do any of the workarounds in the recent responses of that thread (e.g. Page 5) fix the issue for you? There are also occasional responses saying that Xcode 14.1 addressed the issue for them.

knellr commented 1 year ago

The issues are still there on Xcode 14.1. I'm not sure what solution you're referring to but I can't see anything from the thread that's relevant to our setup (beyond the suggestions that require updating the SDK's Package.swift) - while we have a variety of packages, including some local, we don't have the structure described in a couple of them - we're importing the SDK straight from our main app project.

knellr commented 1 year ago

Ah page 2 wasn't loading properly so I didn't see this one, which looks plausible as it would wrap the static library in a shared library, I'll report back

knellr commented 1 year ago

I've had a look at the above approach (creating a local package with a dependency on this one) and it doesn't help, whether creating a statically linked library or a framework.

I tried cloning the repository and updating the Package.swift from this repository to remove the "type: .static" definition (as below) and the issue with previews is resolved.

  products: [
    .library(name: "AppboyKit", targets: ["AppboyKit"]),
    .library(name: "AppboyUI", targets: ["AppboyUI"]),
    .library(name: "AppboyPushStory", targets: ["AppboyPushStory"])
  ],
knellr commented 1 year ago

This is fixed in 14.2 RC, as we were probably all hoping :)