Comments (10)
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.
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.
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.
Alternatively if that is an option for you, you can also use SPM to include the sentry-cocoa dependency:
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.
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.
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.
Thank you, I will try that.
I wonder why only the simulator needs that and not the other targets.
from sentry-kotlin-multiplatform.
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.
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.
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)
- Test Apple targets don't find Sentry framework when using SPM HOT 22
- isCrashedLastRun method
- The Ability to Adjust App Hang Preferences HOT 4
- Cococa deps updater should also update dependencies in samples
- Docs: clarify difference between native android init docs and kmp android init
- Support Compose Multiplatform
- Crashes on App Boot HOT 4
- [Gradle Plugin] Better support for tests not working on cocoa targets
- Implement & Document `lastEventId` with User Feedback
- Improve the KMP SDK
- Make `setSentryUnhandledExceptionHook` public HOT 2
- Build failed for iOS: Undefined symbols for architecture arm64: "_OBJC_CLASS_$_SentryId" HOT 9
- Problem when used together with Phoenix library HOT 9
- Expose platform specific Configuration via expect actual HOT 18
- ci: build iOS app and upload to TestFlight
- Support Spotlight
- Add internal logging mechanism
- Compilation failed: Linking globals named 'kniprot_cocoapods_Sentry3_SentryMetricsAPIDelegate': symbol multiply defined! HOT 9
- WASM support HOT 1
- Send trace origin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-kotlin-multiplatform.