LogoLogo
  • About Absolute Labs
  • Absolute Labs Platform
  • Features
    • Overview
    • Insights
      • My Assets
      • NFT collections
      • Tokens
      • Websites
      • Mobile Apps
        • ALSDK iOS Framework
        • ALSDK Android Framework
      • Investor profile
    • Audiences
      • Segments
      • Custom lists
    • Flows
      • Conditions and delays
        • Wait until
        • Wait for
        • Random split
      • Entry Sources
        • Segment source
        • List source
        • Webhook source
        • List source
        • Transaction source
      • Channels
        • E-mail
        • Webhook
        • XMTP
        • SMS
        • Airdrop
          • Token Airdrops
          • NFT Airdrops
          • Custom contract call
      • Data
        • Add to list
      • Creating a flow
    • Access and invites
    • Google Cloud Integration
    • Salesforce B2C Commerce Cloud Cartridge
  • Use Cases
    • Upcoming NFT collection
    • Metaverse company
    • NFT Marketplace
    • Centralized exchange
    • SendGrid
    • See also
Powered by GitBook
On this page
  • Prerequisites
  • Integration Options
  • Setup
  • Framework initialization
  • Crypto App Detection
  • User ID tracking
  • Event tracking
  1. Features
  2. Insights
  3. Mobile Apps

ALSDK iOS Framework

This guide explains how to integrate the ALSDK framework into your iOS app. You can choose either manual integration or the Swift Package Manager (SPM) method. For dynamic development and easier updates, we recommend using SPM.

Prerequisites

  • iOS Deployment Target: iOS 12 or later

  • Xcode: Version 11 or higher

  • ALSDK.xcframework: The prebuilt framework file

Integration Options

Manual Integration

  1. Download the Framework:

    • Obtain the ALSDK.xcframework folder.

  2. Add to Your Xcode Project:

    • Open your project in Xcode.

    • Drag and drop the ALSDK.xcframework folder into your Project Navigator.

      • Tip: Check “Copy items if needed” to include a local copy.

  3. Link the Framework:

    • Select your app target.

    • Go to the General tab.

    • Under Frameworks, Libraries, and Embedded Content, click the + button, select ALSDK.xcframework, and add it.

    • Set the embed option to Embed & Sign if required.

Swift Package Manager Integration

  1. In Xcode, open your project and choose File > Swift Packages > Add Package Dependency…

  2. Enter the package repository URL.

  3. Select the desired version (e.g., “Up to Next Major” starting at 1.0.0).

  4. Xcode will download and integrate the package automatically.

Setup

For the SDK to be active, there are 2 key elements to add to your code.

Framework initialization

  • In your AppDelegate, import the framework at the top of the file:

    import ALSDK
  • And in the didFinishLaunchingWithOptions method, add the following line of code:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
            ....
            _ = ALSDKManager.shared // Add this line to init the ALSDK
            ...
            return true
        }

This is all it takes to have the SDK monitor your app! Now you need to declare the apps you want to detect.

Crypto App Detection

On iOS, mobile apps can detect the presence of other apps as long as they declare the list of apps prior to packaging the code.

To enable your app to detect the presence of other apps via canOpenURL, you need to declare the URL schemes in your app’s Info.plist using the LSApplicationQueriesSchemes key. Here’s how to do it:

  1. Open Info.plist: In your Xcode project, select your app target and open its Info.plist file.

  2. Add LSApplicationQueriesSchemes:

    • Right-click in the Info.plist editor and choose Add Row.

    • Set the key to LSApplicationQueriesSchemes and its type to Array.

  3. List the Schemes:

    • Under the newly added array, add a new item for each URL scheme you want to query.

  4. Save Changes: Save the file, and your app will now be allowed to call canOpenURL on the schemes you've listed.

Keep the list of apps to detect lean - 5 is a good number to get started. Make sure to mention to Apple during the review process that there schemes are added because you want to provide a seamless experience for your users when they will connect their crypto wallets to your app.

User ID tracking

The SDK allows you to pass it a user ID in order to reconcile visitor context, including wallet presence, and user profile.

To pass a user ID, use the following function on the SDK:

ALSDK.shared.externalId = 'userid@mail.com' // Should use your internal user ID format

Event tracking

You can post custom events via the SDK, in order for instance to have accurate conversion reporting based on them.

To trigger the tracking of an event, call the ALSDK.postCustomEvent function, for instance as follows:

ALSDK.shared.postCustomEvent("Order Successful", "ORDERID-12345")
PreviousMobile AppsNextALSDK Android Framework

Last updated 3 months ago

For the list of apps the ALSDK can detect, and their URL schemes, please refer to .

this list