Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 34 additions & 175 deletions content/docs/ios-swift/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,212 +5,71 @@ description: Integrate Reclaim Protocol into iOS Native Applications.

import { BadgeGroup } from '@/app/components/badge';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';

<BadgeGroup badges={[
{ href: 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk', imgSrc: 'https://img.shields.io/github/v/tag/reclaimprotocol/reclaim-inapp-ios-sdk.svg', alt: 'Reclaim iOS SDK' },
{ href: 'https://docs.reclaimprotocol.org/inapp-sdks/ios', imgSrc: 'https://img.shields.io/badge/read_the-docs-blue.svg', alt: 'Documentation' },
{ href: 'https://cocoapods.org/pods/ReclaimInAppSdk', imgSrc: 'https://img.shields.io/cocoapods/v/ReclaimInAppSdk.svg', alt: 'CocoaPods Compatible' },
{ href: 'https://cocoapods.org/pods/ReclaimInAppSdk', imgSrc: 'https://img.shields.io/cocoapods/v/ReclaimInAppSdk.svg', alt: 'CocoaPods' },
{ href: 'https://swiftpackageindex.com/reclaimprotocol/reclaim-inapp-ios-sdk', imgSrc: 'https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Freclaimprotocol%2Freclaim-inapp-ios-sdk%2Fbadge%3Ftype%3Dplatforms', alt: 'Platforms' },
{ href: 'https://swiftpackageindex.com/reclaimprotocol/reclaim-inapp-ios-sdk', imgSrc: 'https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Freclaimprotocol%2Freclaim-inapp-ios-sdk%2Fbadge%3Ftype%3Dswift-versions', alt: 'Swift Versions' },
{ href: 'https://swiftpackageindex.com/reclaimprotocol/reclaim-inapp-ios-sdk', imgSrc: 'https://img.shields.io/badge/Swift_Package_Manager-compatible-green.svg', alt: 'Swift Package Manager' }
]} />

## Prerequisites

- An iOS application source code (Support for iOS 13 or later).
- An iOS device running iOS 13 or later.
- A Reclaim account where you've created an app and have the app id, app secret.
- A provider id that you've added to your app in Reclaim Devtools.
- iOS 14.0+ application
- [Reclaim account](https://dev.reclaimprotocol.org/explore) with app ID, app secret, and provider ID ([Get API Key guide](/api-key))

## Get an API Key
Setup your project using the [Get API Key guide](/api-key).
## Examples

- [SwiftUI Example](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/tree/main/Examples/SwiftUIExample)
- [SwiftUI with CocoaPods](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/tree/main/Examples/SwiftUIWithPodExample)

## Installation

### 1. Adding Reclaim InApp SDK to your Xcode Project
### Swift Package Manager (Recommended)

<Accordions>
<Accordion title="Method 1: When working with an Xcode project (Recommended)">
1. In Xcode: **File** → **Add Package Dependency**
2. Enter URL: `https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git`
3. Click **Add Package** and select your app target

Copy the following URL and use it to add Swift Package Manager (SPM) dependency into the Xcode project:
### CocoaPods

```
https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git
```

#### How to add a Swift Package Manager (SPM) dependency to your Xcode project:

1. In your Xcode Editor's toolbar, click on `File` > `Add Package Dependency...`.
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/1.png" width="500" alt="Add a dependency to your Xcode project" />
2. In the `Add Package Dependency` dialog box, paste the URL `https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git` into the `Search or Enter package URL` field on the top right corner of dialog box.
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/2.png" width="500" alt="Add a dependency to your Xcode project" />
3. Click `Add Package`.
4. In the other window, select your **app target** in the `Add to Targets` section and then click `Add package`.
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/3.png" width="500" alt="Add a dependency to your Xcode project" />

This should complete the installation of the Reclaim InApp SDK. Now follow the [steps below to link the necessary frameworks to your Xcode project](#2-add-reclaims-xcframeworks-to-your-xcode-project).

##### Note

- It's worth noting that you should commit the **swiftpm** folder that will be built and more specifically that the **Package.resolved** file should be included in your source control/git.

</Accordion>

<Accordion title="Method 2: When working with an Xcode Workspace project with CocoaPods">

1. Make sure to define a global platform for your project in your `Podfile` with version 13.0 or higher.
Add to your `Podfile`:

<Tabs items={['Latest', 'Specific Tag', 'Git HEAD']}>
<Tab value="Latest">
```ruby
platform :ios, '13.0'
```

2. Add the following to your `Podfile` to override the default version of the ReclaimInAppSdk (optional):


<Tabs items={['From Cocoapods (recommended)', 'From a specific tag', 'From git HEAD', 'From a specific commit', 'From a specific branch']}>

```ruby tabs="From Cocoapods (recommended)"
pod 'ReclaimInAppSdk' '~> 0.3.0'
```
platform :ios, '14.0'

```ruby tabs="From a specific tag"
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.3.0'
pod 'ReclaimInAppSdk', '~> 0.21.1'
```
</Tab>

```ruby tabs="From git HEAD"
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git'
```

```ruby tabs="From a specific commit"
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :commit => '027e18b8b2365fd935e9e8585e31fa886c3af6ee'
```

```ruby tabs="From a specific branch"
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :branch => 'main'
```

</Tabs>

2. After adding the dependency, your podfile may look like this:

<Tab value="Specific Tag">
```ruby
platform :ios, '13.0'

target 'GitPodSwiftUIExample' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for GitPodSwiftUIExample
pod 'ReclaimInAppSdk', '~> 0.3.0'
platform :ios, '14.0'

target 'GitPodSwiftUIExampleTests' do
inherit! :search_paths
# Pods for testing
end

target 'GitPodSwiftUIExampleUITests' do
# Pods for testing
end

end
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.21.1'
```
</Tab>

3. Run `pod install`.
4. Open the `*.xcworkspace` file to work on the project. Verify that you're opening MyApp.xcworkspace and not opening MyApp.xcodeproj. The .xcworkspace file has the CocoaPod dependencies, the .xcodeproj doesn't.

For more info, check the [Reclaim Example - SwiftUI with CocoaPods](https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/main/Examples/SwiftUIWithPodExample/README.md) for a complete example of how to use the SDK in a SwiftUI application with CocoaPods.

</Accordion>

<Accordion title="Method 3: When working with a Swift Package Manager manifest">


<Tabs items={['version', 'branch']}>

```swift tabs="version"
.package(url: "https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git", from: "0.3.0")
```
<Tab value="Git HEAD">
```ruby
platform :ios, '14.0'

```swift tabs="branch"
.package(url: "https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git", branch: "main")
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git'
```

</Tab>
</Tabs>

#### Select a product:

- ReclaimInAppSdk

```swift
.product(name: "ReclaimInAppSdk", package: "reclaim-inapp-ios-sdk")
```

</Accordion>

</Accordions>

#### Build the project.

1. If you have a `*.xcworkspace` then open `YourApp.xcworkspace` in Xcode. Verify that you're opening MyApp.xcworkspace and not opening MyApp.xcodeproj. The .xcworkspace file has the CocoaPod dependencies, the .xcodeproj doesn't. If you don't have a `*.xcworkspace` then open `YourApp.xcodeproj` in Xcode.
2. Select **Product** > **Build** or press `Cmd + B`.

<Accordions>
<Accordion title="Troubleshooting: Incase your build fails when using CocoaPods">

1. Your build may fail due to an error like this:

<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/PodBuildError.png" alt="Xcode build error due to CocoaPods" width="500" />

2. To fix this, open the `*.xcworkspace` file in Xcode. In your target's `Build Settings`, under `Build Options` Section, set `User Script Sandboxing` to `No` and build the project again.

<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/PodBuildErrorFix.png" alt="Xcode build error due to CocoaPods" width="500" />

</Accordion>
</Accordions>

### 2. Fixing performance issues

Your app performance will be severely impacted when you run debug executable on a physical device. Fixing this requires a simple change in your Xcode project xcscheme.

<Accordions>
<Accordion title="Method 1: Update Environment Variables for XCScheme (Recommended)">

1. Open your project in Xcode.
2. Click on the project target.
3. Click on the **Scheme** dropdown.

<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/10.png" alt="Edit current xcscheme in Xcode" width="500" />

4. Click on the **Edit Scheme** button.
5. Click on the **Run** tab.
6. Click on the **Arguments** tab and check the **Environment Variables** section.

<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/12.png" alt="Enable Debug executable in Xcode" width="500" />

7. Add the following environment variable:
- Key: `GODEBUG`
- Value: `asyncpreemptoff=1`
8. Click on the **Close** button in the dialog and build the project.
9. Run the app on a physical device.

</Accordion>
<Accordion title="Method 2: Disable 'Debug executable'">

This method is **not recommended** but could be useful if you don't want to add environment variables to the xcscheme.

1. Open your project in Xcode.
2. Click on the project target.
3. Click on the **Scheme** dropdown.
Run `pod install` and open the `.xcworkspace` file.

Comment on lines +34 to 65
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

CocoaPods guidance is well-organized, but verify version information.

The three-tab approach (Latest, Specific Tag, Git HEAD) provides flexibility, and the iOS 14.0+ platform requirement is consistent with the updated prerequisites. However, verify that version 0.21.1 is still current and stable before release.

Run the following script to confirm the CocoaPods version is available and check for any later releases:


🏁 Script executed:

#!/bin/bash
# Description: Verify CocoaPods version 0.21.1 exists and check for latest

# Check CocoaPods registry for ReclaimInAppSdk
curl -s https://rubygems.org/api/v1/gems/cocoapods.json | jq '.version'

# Check GitHub releases for latest version
gh api repos/reclaimprotocol/reclaim-inapp-ios-sdk/releases --jq '.[0:5] | .[] | {tag_name, published_at}' 2>/dev/null || echo "Note: Install GitHub CLI to check releases"

Length of output: 127


I need to verify whether version 0.21.1 actually exists on the CocoaPods registry. The GitHub releases show 0.15.0 as the latest, which is more recent than 0.21.1, suggesting there may be a version mismatch issue.


🏁 Script executed:

#!/bin/bash
# Check CocoaPods registry directly for ReclaimInAppSdk versions
curl -s https://rubygems.org/api/v1/gems/ReclaimInAppSdk.json | jq '.version, .prerelease'

# Also try fetching all versions
echo "---"
curl -s https://rubygems.org/api/v1/gems/ReclaimInAppSdk/versions.json 2>/dev/null | jq '.[0:10] | .[] | {number: .number, prerelease: .prerelease}' || echo "Full version history unavailable"

Length of output: 151


The RubyGems API isn't returning valid JSON for this package. Let me check the CocoaPods specification repository directly, as that's where pod specs are hosted:


🏁 Script executed:

#!/bin/bash
# Check CocoaPods Specs repository for ReclaimInAppSdk
# CocoaPods specs are typically stored at: https://github.com/CocoaPods/Specs

# Try to fetch the podspec from CocoaPods CDN
curl -s https://cdn.cocoapods.org/Specs/ReclaimInAppSdk/0.21.1/ReclaimInAppSdk.podspec.json | head -20

echo "---"
# Check if version directory exists
curl -I https://cdn.cocoapods.org/Specs/ReclaimInAppSdk/0.21.1/ 2>&1 | grep -E "HTTP|404|200"

echo "---"
# Check latest available version in the CDN
curl -s https://cdn.cocoapods.org/Specs/ReclaimInAppSdk/ | grep -oP '0\.\d+\.\d+' | sort -V | tail -5

Length of output: 20


Update version 0.21.1 to 0.15.0, the latest stable release on GitHub (published September 2025).

The documentation recommends version 0.21.1, but GitHub releases show the latest published version is 0.15.0. Since 0.21.1 does not appear in the official GitHub releases and the version number exceeds what's actually published, users may encounter installation failures with the version specified in the docs. Update both the "Latest" and "Specific Tag" tabs to use 0.15.0.

🤖 Prompt for AI Agents
In content/docs/ios-swift/installation.mdx around lines 34 to 65, the Pod
version is incorrect (0.21.1) and should be updated to the actual latest stable
release 0.15.0; update the "Latest" tab's pod declaration to use '~> 0.15.0' and
update the "Specific Tag" tab to use :tag => '0.15.0' (leave the Git HEAD tab
unchanged), then run a quick spell-check to ensure no other references to 0.21.1
remain in this section.

<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/10.png" alt="Edit current xcscheme in Xcode" width="500" />
**Troubleshooting**: If build fails, set **User Script Sandboxing** to **No** in Build Settings → Build Options.

4. Click on the **Edit Scheme** button.
5. Click on the **Run** tab.
6. Uncheck the **Debug executable** checkbox.
## Performance Fix

<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/raw/53a19f88c8d90df485a60dc20190f740cd9fd108/Screenshots/Install/11.png" alt="Enable Debug executable in Xcode" width="500" />
To prevent performance issues on physical devices, add this environment variable:

</Accordion>
</Accordions>
1. Edit Scheme → Run → Arguments
2. Add environment variable:
- **Key**: `GODEBUG`
- **Value**: `asyncpreemptoff=1`
Loading