Giter Club home page Giter Club logo

Comments (10)

buenaflor avatar buenaflor commented on May 30, 2024 1

@StefanOltmann

You can configure it as follows:

Add the XCFramework to your project and add this to your KMP config:

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "shared"
            when (it.name) {
                "iosSimulatorArm64" -> {
                    linkerOpts("-framework", "Sentry", "-F/path/to/framework/")
                }
                "iosArm64" -> {
                    linkerOpts("-framework", "Sentry", "-F/path/to/framework/")
                }
                "iosX64" -> {
                    linkerOpts("-framework", "Sentry", "-F/path/to/framework/")
                }
            }
        }
    }

Just make sure to reference the correct framework based on your target platform.
But please note that currently we officially support sentry-cocoa version 8.4.0. It might or might not work with other versions.

However, so far this configuration still leads to a problem where you cannot launch the iOS app through the KMP plugin in Android Studio but need to launch it directly from XCode. This still needs some investigation why.

from sentry-kotlin-multiplatform.

buenaflor avatar buenaflor commented on May 30, 2024 1

Sry, should've added the rest of the code. You will need to specify each target and the respective framework of course.

Nonetheless thank you for the issue, this should also be documented in our docs.

from sentry-kotlin-multiplatform.

msasikanth avatar msasikanth commented on May 30, 2024 1

Got it. The framework is already static, I think I would have to mark those symbols as undefined like you mentioned in the issue. Thanks 👍🏾

from sentry-kotlin-multiplatform.

buenaflor avatar buenaflor commented on May 30, 2024

Alternatively if that is an option for you, you can also use SPM to include the sentry-cocoa dependency:

https://docs.sentry.io/platforms/kotlin-multiplatform/install/swift-package-manager/?original_referrer=https%3A%2F%2Fwww.google.com%2F

The only caveat here currently is that you need to export the shared framework as static. Some context as to why and how to fix this in the future: #108

from sentry-kotlin-multiplatform.

StefanOltmann avatar StefanOltmann commented on May 30, 2024

I presently utilize the Sentry XCFramework, which is provided as a ZIP file on the releases page, and this setup serves me well. I have contemplated transitioning to the Multiplatform option to streamline my codebase, although I am reluctant to do so if it involves incorporating CocoaPods.

from sentry-kotlin-multiplatform.

buenaflor avatar buenaflor commented on May 30, 2024

You don't necessarily need cocoapods. The only thing you need for the SDK to work (on apple platforms) is providing the sentry-cocoa SDK binary and cocoapods is one way to do that. I haven't checked on how a pre-built XCFramework needs to be linked in this case.

It might be as easy as linkerOpts("-framework", "MyFramework", "-F/path/to/framework/")

But I'll check that out and get back to you on how to configure it.

from sentry-kotlin-multiplatform.

StefanOltmann avatar StefanOltmann commented on May 30, 2024

Thank you, I will try that.
I wonder why only the simulator needs that and not the other targets.

from sentry-kotlin-multiplatform.

msasikanth avatar msasikanth commented on May 30, 2024

Hi, I have noticed an issue when migrating from cocoapods to regular framework. So flagging it here.

After removing cocoapods plugin from KMP, I have added Sentry cocoa dependency using SPM and the ran app from Xcode and everything worked correctly. But when I tried to run the iOS tests in the common module. I keep getting this error, not entirely sure how I can resolve this. Didn't had this issue when using pod dependency.

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_PrivateSentrySDKOnly", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryAttachment", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryBreadcrumb", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryDependencyContainer", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryEnvelope", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryEnvelopeHeader", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryEnvelopeItem", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryEvent", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryException", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryHttpStatusCodeRange", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryId", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryMechanism", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryMessage", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentrySDK", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryScope", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryUser", referenced from:
      objc-class-ref in result.o
  "_OBJC_CLASS_$_SentryUserFeedback", referenced from:
      objc-class-ref in result.o
ld: symbol(s) not found for architecture arm64

from sentry-kotlin-multiplatform.

buenaflor avatar buenaflor commented on May 30, 2024

@msasikanth

hi, please refer to our sentry doc on how to set it up.

Essentially you need to export your shared framework as static (for now) if you'd like to use SPM.

As for your error, read #108 if you like to understand why this is happening and our future plan on how to support this better

from sentry-kotlin-multiplatform.

romtsn avatar romtsn commented on May 30, 2024

Let's track this in #108 where we'll look for adding a gradle plugin that configures this automatically without a need for cocoapods (we could even just download the sentry-cocoa binaries from the gradle plugin or ship them together to avoid a need for any package manager like cocoapods/carthage)

from sentry-kotlin-multiplatform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.