Skip to content

Commit

Permalink
feat(kmp): improve spm docs (#9360)
Browse files Browse the repository at this point in the history
* Improvements

* Update

* update

* update

* update

* Apply suggestions from code review

Co-authored-by: Liza Mock <liza.mock@sentry.io>

* Update

---------

Co-authored-by: Liza Mock <liza.mock@sentry.io>
  • Loading branch information
buenaflor and lizokm authored May 2, 2024
1 parent 64827d6 commit 37947f5
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 118 deletions.
11 changes: 10 additions & 1 deletion docs/platforms/kotlin-multiplatform/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ The table below lists supported platforms and their corresponding presets.

### Swift Package Manager (SPM)

In addition to Cocoapods, our Kotlin Multiplatform SDK can also be installed via Swift Package Manager for Apple targets. Learn more [here](/platforms/kotlin-multiplatform/swift-package-manager/).
Swift Package Manager (SPM) is a powerful tool for managing dependencies in Swift that allows developers to enjoy a more native integration experience with Xcode.
If you already use SPM or prefer it over other package managers on Apple platforms, this guide will show you how to install the Kotlin Multiplatform SDK while using Swift Package Manager.

#### Install

In order to install the Sentry Kotlin Multiplatform SDK, you need to use Cocoapods and Swift Package Manager simultaneously which might seem unconventional at first, especially if you're accustomed to using SPM for all your dependencies. However, you can achieve a smooth integration by using the Kotlin Cocoapods plugin specifically for compiling and building the shared framework. You can then continue to manage all other dependencies with SPM as usual.

Follow the steps for our primary installation method [Cocoapods](/platforms/kotlin-multiplatform/#install) to install the Sentry Kotlin Multiplatform SDK.

After you've consumed the shared framework in your application via Cocoapods, you can continue with SPM for other dependencies without disrupting your existing workflow.
115 changes: 0 additions & 115 deletions docs/platforms/kotlin-multiplatform/swift-package-manager.mdx

This file was deleted.

51 changes: 49 additions & 2 deletions docs/platforms/kotlin-multiplatform/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,58 @@
---
title: Troubleshooting
description: "Troubleshoot and resolve edge cases regarding known limitations and bundling."
description: "Troubleshoot and resolve edge cases when using Sentry's Kotlin Multiplatform SDK."
sidebar_order: 9000
---

If you need help solving issues with Sentry's Kotlin Multiplatform SDK, you can read the edge cases documented here. If you need additional help, you can [ask on GitHub](https://github.com/getsentry/sentry-kotlin-multiplatform/issues/new/choose). Customers on a paid plan may also contact support.
This document covers common issues you may encounter when using the Sentry Kotlin Multiplatform SDK and provides steps to troubleshoot.

If you need additional help, [ask on GitHub](https://github.com/getsentry/sentry-kotlin-multiplatform/issues/new/choose). Customers on a paid plan can also contact [support](https://help.sentry.io/).

## "Missing API declaration" after App Store review

Starting May 1, 2024, Apple requires all apps submitted to the App Store to provide a list of privacy-related APIs they use, including the reasons under which they use it. If you received an email from Apple with the message "ITMS-91053: Missing API declaration", your app doesn't fulfill the requirements. To solve this, follow our [Apple Privacy Manifest](/platforms/kotlin-multiplatform/data-management/apple-privacy-manifest) guide.

## Tests Not Working

If you configured the Sentry Kotlin Multiplatform SDK and tests are still failing with the following error: `ld: framework 'Sentry' not found` then follow these steps for the workaround:

<Note>
This example shows you how to fix the issue for the iOS simulator target, but the same approach can be used for other targets.
</Note>

**1. Download the Sentry xcframework**

- Choose the Sentry Cocoa release based on the version specified in the [version compatibility table](/platforms/kotlin-multiplatform/#cocoa-sdk-version-compatibility-table)
- Download the `Sentry.xcframework.zip` on [GitHub](https://github.com/getsentry/sentry-cocoa/releases), and unzip it.

**2. Create a frameworks directory and insert `Sentry.framework`**

Create a `/Frameworks` directory in the directory where the `test.kexe` resides and put the `Sentry.framework` in it.
- The `Sentry.framework` can be found inside of the `ios-arm64_x86_64-simulator`.
- The `test.kexe` will usually reside in `build/bin/iosSimulatorArm64/debugTest`.

**3. Add linker options**

Modify `shared/build.gradle.kts` to include linker options, as shown below:

```kotlin {filename:shared/build.gradle.kts}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "shared"
}
it.compilations.all {
if (compilationName == "test" && target.platformType == KotlinPlatformType.native) {
compilerOptions.configure {
freeCompilerArgs.add("-linker-options")
freeCompilerArgs.add("-F/your/path/Carthage/Build/Sentry.xcframework/ios-arm64_x86_64-simulator/")
}
}
}
}
```

**4. Run the tests**

0 comments on commit 37947f5

Please sign in to comment.