Open calda opened 1 year ago
cc @abertelrud
Refer this, Might helpful to team.
Thanks for the suggestion. When I try that I get the following package validation error:
invalid type for binary product 'Lottie'; products referencing only
binary targets must have a type of 'library'
If I remove type: .dynamic
below then the error goes away, so it sounds like this configuration isn't supported in this case. Not sure if that's intentional or not -- the wording in the error is a little confusing.
// Package.swift
let package = Package(
name: "Lottie",
platforms: [.iOS("11.0"), .macOS("10.10"), .tvOS("11.0")],
products: [
.library(
name: "Lottie",
type: .dynamic,
targets: ["Lottie"])
],
targets: [
.binaryTarget(
name: "Lottie",
url: "https://github.com/airbnb/lottie-ios/releases/download/4.1.2/Lottie.xcframework.zip",
checksum: "3fc1e8054e3749caee0ae189770b6793a6ab3292b4d9d8fd1b8762265339c14b"),
])
cc @neonichu
We have a workspace, 1 project that contains the app, several other projects that are used by the app. One of those other projects has an SPM dependency which uses the lottie-spm 4.2.0 package. We noticed the same crash as described in this issue (crash on device only with dyld file not found error). We added the lottie-spm package as a dependency to the app project and it seems to have fixed the issue.
Edit: If we added the same package that depends on lottie-spm to the app project, that also crashed on device.
invalid type for binary product 'Lottie'; products referencing only binary targets must have a type of 'library'
Seems like the diagnostic has regressed here, I believe it was supposed to say "type automatic" or something similar
Might be the other way around, the current diagnostic looks good. See https://github.com/apple/swift-package-manager/blob/main/Sources/PackageLoading/ManifestLoader%2BValidation.swift#L268
We have a workspace, 1 project that contains the app, several other projects that are used by the app. One of those other projects has an SPM dependency which uses the lottie-spm 4.2.0 package. We noticed the same crash as described in this issue (crash on device only with dyld file not found error). We added the lottie-spm package as a dependency to the app project and it seems to have fixed the issue.
Edit: If we added the same package that depends on lottie-spm to the app project, that also crashed on device.
The same happens with our project as well
Here's a similar bug report from @Semty (with a sample project) which demonstrates this issue: https://github.com/airbnb/lottie-ios/issues/2233
We have a workspace, 1 project that contains the app, several other projects that are used by the app. One of those other projects has an SPM dependency which uses the lottie-spm 4.2.0 package. We noticed the same crash as described in this issue
There are a few manual workarounds, including adding a custom shell script step that manually copies the Lottie.framework
into the application Frameworks
directory, but ideally this would work automatically since the lottie-spm
SPM package has a dependency on this binary.
Description
We have a lottie-spm package that wraps the lottie-ios repo by providing a product that just contains a binary target:
I'm able to depend on this package from test targets and iOS app simulator builds without any issues, but Xcode doesn't let you embed the framework into an app product. This causes an app to crash when ran on a physical device. You can reproduce this by building the Example iOS app in lottie-spm 4.0.1 and then running it on a physical iOS device (it crashes).
We were able to work around this issue by adding an additional stub / empty target to the package:
I expect both package definitions to work correctly here.
Not sure if this is an issue with SPM or Xcode. Let me know if you'd prefer me to file a feedback on Xcode instead.
Expected behavior
A package with a single binary target should be able to be embedded into an iOS app via Xcode
Actual behavior
A package with a single binary target cannot be embedded into an iOS app via Xcode, and causes the app to crash when ran on a physical iOS device
Steps to reproduce
Build the Example iOS app in lottie-spm 4.0.1 and then run it on a physical iOS device (it crashes).
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version && uname -a
)Swift 5.7