Docs

Docs

  • Guides
  • Integrations

›Integration

API Guide

  • Android
  • iOS
  • Web
  • React Native
  • Cordova

Integration

  • Android SDK (androidx)
  • Android SDK
  • Android SDK (Staging)
  • iOS SDK
  • iOS SDK (Staging)
  • iOS SDK (Manual)
  • iOS Push Notifications
  • Web SDK
  • React Native SDK
  • Cordova SDK

Performance

  • Android
  • iOS

Third Party Support

  • Tracking Third Party
  • Firebase
  • Clevertap
  • Moengage
  • Webengage
  • Segment
  • Appsflyer
  • Branch

Release Notes

  • Android
  • iOS

APXOR iOS SDK Manual Integration Guide

Getting started with Apxor iOS SDK

Plugin NameLatest VersionRelease Date
ApxoriOSSDK-Core2972023-07-14
ApxoriOSSDK-WYSIWYG1252022-12-29
ApxoriOSSDK-CE1492023-07-08
ApxoriOSSDK-RTA1862023-05-29
ApxoriOSSDK-Survey1352023-07-12
ApxoriOSSDK-Push1072022-12-29
Plugin NameDescription
ApxoriOSSDK-CoreThe Core Plugin is responsible for the basic event tracking
  • Download the above and Unzip to find ApxorSDK.framework directory

Adding Apxor SDK to your project

  1. Add ApxorSDK.framework to your "Frameworks, Libraries and Embedded Content" list.
    (for xcode < 11, under “Embedded Binaries”)

  2. Also add the libsqlite3.dylib (or libsqlite3.0.tbd) library to the same list. Add Frameworks

  3. Under build settings tab, in "Other Linker Flags", add -ObjC , if not already present. Other Linker Flags

Add Apxor script

  • Add the following in the Run script phase in your build phases.
# Script to strip unwanted architectures

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name '*[A][Pp][Xx]*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done


Note

Make sure the "Run Script" phase is placed after "Embedded Frameworks"

Build Phases Order

Plugins Integration

  • Add the libraries to your application's "Frameworks, Libraries and Embedded Content" list. (Click on the plugin name to download)

  • Apxor provides you two easy to use plugins for your Actions. They are:

Plugin NameDescription
APXSurveyPluginThis Plugin helps you create contextual surveys to capture your users' feedback, ratings, etc.
APXRTAPluginThis Plugin helps you create real time actions.
  • Make sure to add the following dependency plugins as well,
Plugin NameDescription
CEThe Secret Sauce
APXPushPluginThe Push Plugin allows you to send push notifications to your device in real time
APXWYSIWYGPluginThe WYSIWYG Plugin allows you to preview your configured actions onto your device in real time

Initialize Apxor iOS SDK

  • To Auto initialize SDK (Recommended), add the following inside your application plist file.

  • Open your application's Info.plist as source code. Open Plist as Source Code

  • Copy paste the below piece of code, to create an entry for ApxorSDK.

<key>Apxor</key>
<dict>
    <key>Core</key>
    <string>{YOUR_APP_ID}</string>
    <key>APXSurveyPlugin</key>
    <true/>
    <key>APXRTAPlugin</key>
    <true/>
    <key>APXWYSIWYGPlugin</key>
    <true/>
</dict>
  • To manually initialize SDK (Not Recommended), call ApxorSDK.initialize method in your Application class

    //...
    #import "ApxorSDK/ApxorSDK.h"
    
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
        [ApxorSDK initializeApxorWithID:@"<YOUR_APP_ID>"];
        // ... your code
    }
    

Note

To get your app ID, please email us at contact@apxor.com

  • Your plist should look something like this

Plist with Apxor Entry

Configuring Test Device

  • First, you need to configure your app to ensure there is a URL Scheme with your application's bundle identifier as the value.
  • If your app already has a URL Scheme with your application's bundle identifier as the value, you can skip this step.

Configure URL Scheme

  • To configure URL scheme, goto your project settings, select Targets. Click on the Info tab.
  • Select the URL Types, and click on the + button to add a new URL Scheme.
  • Add a new URL Scheme with your bundle identifier as the value.
  • Your bundle identifer will be in the format, com.xxxx.xxxx
  • Use the image below for reference. Configure URL scheme

Note

Make sure the URL scheme has the value of your bundle identifier that was provided in the dashboard while registering with us. Also, the app must have same bundle identifier.

Handling the deep link

  • Secondly, you'd need to enable Apxor to handle Apxor specific deeplinks.
  • In your application's AppDelegate file, in the function application(_:open:options:), add the following code at the beginning,
/*
  Apxor's code to handle deeplinks
  */
let urlStr = url.absoluteString
if (urlStr.contains("add-test-device")) {
    ApxorSDK.handleDeeplink(url)
}
  • Use the image below for reference.

Handle deep links

  • This will ensure the Apxor specific deep links are handle by our SDK.

Configuring Push Notifications

  • To use the push notifications feature, make sure the following lines exist in your application plist file under Apxor section.
<key>APXPushPlugin</key>
<true/>
  • To configure iOS Push notification via Apxor dashboard, you'd need to upload APNs Auth Key file along with it's ID (key ID), your Team ID, and your application's Bundle ID.

  • The APNs Auth Key is the best way to configure pushes, as you don't need to regenerate a certificate every year and also, this key can be used to configure Push notifications to sever of your applications (under the same apple developer account)

  • Things required to configure iOS Push notification:

    • Auth Key file
    • Key ID (usuallly the name of the Auth Key file)
    • Team ID (the 10 digit alphanumeric key)
    • Your app’s bundle ID (in the format com.abc.xyz)
  • See here on how to get these, Push notifications docs

  • Once you get those details, add the below code in your application's AppDelegate file in the application didRegisterForRemoteNotificationsWithDeviceToken function.

import APXPushPlugin

let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
let token = tokenParts.joined()
print("Device Token: \(token)")
APXPushPlugin.setPushDeviceToken(token)
[APXPushPlugin setPushDeviceToken:token];
  • The token can be passed in either the NSData or NSString format SDK Init Logs

  • If you haven't already used the code to Ask User for notifications permission, add the following function in your AppDelate file.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

  // your existing code ...

  registerForPushNotifications()

  // ...
}

func registerForPushNotifications() {
  UNUserNotificationCenter.current()
    .requestAuthorization(options: [.alert, .sound, .badge]) { [weak self] granted, error in
      print("Permission granted: \(granted)")
      guard granted else { return }
      self?.getNotificationSettings()
    }
}

func getNotificationSettings() {
  UNUserNotificationCenter.current().getNotificationSettings { settings in
    print("Notification settings: \(settings)")
    guard settings.authorizationStatus == .authorized else { return }
    DispatchQueue.main.async {
      UIApplication.shared.registerForRemoteNotifications()
    }
  }
}

Ensuring ApxorSDK is initialised successfully

  • Lookout for the following log

SDK Init Logs

Note

ApxorSDK uploads data when the app is minimized to the background. If you are running from XCode (simulators or devices), do not stop the app, just press on the "home" button in order for data to be uploaded.

API Guide

Read API Guide here

← iOS SDK (Staging)iOS Push Notifications →
  • Getting started with Apxor iOS SDK
  • Adding Apxor SDK to your project
  • Add Apxor script
  • Plugins Integration
  • Initialize Apxor iOS SDK
    • Configuring Test Device
    • Configuring Push Notifications
  • Ensuring ApxorSDK is initialised successfully
  • API Guide
Integrations
AndroidiOSWeb
API Guide
AndroidiOSWeb
Apxor
Copyright © 2023 Apxor Technology Solutions Pvt. Ltd.