10.4 C
Canberra
Friday, September 20, 2024

ios – Distribute Framework in SPM with Sentry


I’ve a framework that’s distributed via cocoaPods and now I need to help SPM

I created a package deal in xCode, as Supply code I solely have a dummy swift file as a result of my framework is an already compiled XCFramework

My Package deal.Swift has the next format

    let package deal = Package deal(
    title: "MyLibrary",
    platforms: [
        .iOS(.v12)
    ],
    merchandise: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "MyLibrary",
            targets: ["MyLibraryWrapper"]),
    ],
    dependencies: [
        .package(name: "Sentry", url: "https://github.com/getsentry/sentry-cocoa", .exact("8.32.0")),
        .package(name: "Lottie", url: "https://github.com/airbnb/lottie-spm", .exact("4.3.4")),
        ... other packages ...
    ],
    targets: [
        .binaryTarget(
            name: "MyLibrary",
            url: "MyLibraryURL",
            checksum: "709e8beedce6029b439e7d4bb59e1830060b642b96791586c65a6520ca5ba908"
        ),
        .target(
            name: "MyLibraryWrapper",
            dependencies: [
                .target(name: "MyLibrary"),
                .product(name: "Sentry", package: "Sentry"),
                .product(name: "Lottie", package: "Lottie"),
                ... other packages ...
            ],
            path: "Sources",
            sources: ["dummy.swift"]
        )
    ],
    swiftLanguageVersions: [.v5]
  )

once I import this with SPM into the challenge the whole lot seems to be okay and all MyLibrary dependencies are loaded.

however once I run the app I’ve the next error

dyld[4233]: Image not discovered: _OBJC_CLASS_$_SentryClient
  Referenced from: /non-public/var/containers/Bundle/Utility/373D3B20-3FF1-4C21-8D83-613FBFE37BB3/Pattern App.app/Frameworks/MyLibrary.framework/MyLibrary
  Anticipated in: /non-public/var/containers/Bundle/Utility/373D3B20-3FF1-4C21-8D83-613FBFE37BB3/Pattern App.app/Frameworks/Sentry.framework/Sentry
Message from debugger: killed

Earlier than Sentry I had the identical issues with Lottie however then I simply needed to change the repo

from:
https://github.com/airbnb/lottie-ios.git

to:
https://github.com/airbnb/lottie-spm

I searched and did not discover something about this within the points reported in Sentry’s git.

I additionally tried to import Sentry straight as a targetBinary however with out success.

I attempted to vary the title to sentry-cocoa as reported on this hyperlink but it surely did not work.
Swift package deal product not discovered when added through Package deal.swift dependency

And check out with completely different Sentry variations and at all times have this difficulty

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles