Adding and Installation

Adding SDK

You can add the Related Digital iOS SDK to your project via Cocoapods or Swift Package Manager (SPM).

Cocoapods

Add the following line to your podfile to install the SDK.

pod 'RelatedDigitalIOS'

SPM

First, go to File > Add Packages… from the Xcode menu.

On the page that opens, paste the https://github.com/relateddigital/relateddigital-ios link in the upper right area and click the Add Package button.

Note: If you are not going to use the Push Module, you do not need to add push-related ones in the given codes.

Setup

Import RelatedDigitalIOS in your AppDelegate.swift file. Then add the following codes to didFinishLaunchingWithOptions. These codes activate Related Digital Analytics and Push modules.

import RelatedDigitalIOS import UserNotifications func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { RelatedDigital.initialize(organizationId: "YOUR_ORGANIZATION_ID", profileId: "YOUR_PROFILE_ID", dataSource: "YOUR_DATA_SOURCE", launchOptions: launchOptions) RelatedDigital.enablePushNotifications(appAlias: "YOUR_APP_ALIAS", launchOptions: launchOptions, appGroupsKey: "YOUR_APP_GROUP_KEY", deliveredBadge: true) UNUserNotificationCenter.current().delegate = self RelatedDigital.loggingEnabled = true RelatedDigital.inAppNotificationsEnabled = true if #available(iOS 13, *) { // handle push for iOS 13 and later in sceneDelegate } else if let userInfo = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as? [String: Any] { RelatedDigital.handlePush(pushDictionary: userInfo) } return true }

Optional parameters

loggingEnabled: If you want the SDK to print logs to the console, you must pass this value to true. In this way, you can see the requests, responses and errors, if any, from the SDK.

inAppNotificationsEnabled: If you are going to display Target Actions such as InApp Message (Popup, Survey with Numbers, etc.), Wheel of Fortune, Scratchcard, Story in your application, you must pass this value to true.

geofenceEnabled: If you plan to send push based on the location of your users, you should pass this value to true.

Getting OrganizationId, ProfileId, and Data Source Information

After logging into your account in RMC Panel, you can access the information by following the steps below.

First of all, we enter the Management > Profiles page from the top menu.

Then click the button under Actions on this page.

Finally, you can get the relevant information from the fields shown in the image.

Getting App Alias Information

In order to get App Alias information, you must first define an application in the panel. App Alias is a unique value. Each app can have its own App Alias. You set this value.

After logging into the panel, we come to the Settings icon in the upper right and enter the Campaign Management page and from this page we enter the Push Applications page to add applications.

From the Push Applications page, we click the New iOS Application button.

On the page that opens, you must first choose whether to use the P12 certificate or the P8 certificate. Here are the most obvious differences between P12 and P8 certifications.

The P12 certificate is for a period of time and you need to renew it after 1 year. P8 certification, on the other hand, is unlimited.

To push to test applications, you need to produce and install the Development version of the P12 certificate, and to push to the Live application, you need to produce and install the Production version of the P12 certificate. There is no such distinction in the P8 certificate.

Creating a P12 Certificate

Creating a P8 Certificate

P12 certified application identification

You can give the name you want to the application name field. The general usage example is as follows: Related Digital iOS

Select your P12 file and enter the password you created while extracting it from KeyChain in the P12 Password field.

As a platform, if you are going to work in the test application (Debug Mod application opened only through XCode), choose Test. Choose Prod if you are going to work on a live application (available in Testflight or published in the AppStore).

You can enter any value you want as the App Alias value without using Turkish characters and spaces. The general usage example is as follows: related_digital_ios

P8 certified application identification

You can give the name you want to the application name field. The general usage example is as follows: Related Digital iOS

Select your P8 file. In the Bundle ID field, enter the Bundle ID of your project. In the Team ID field, you enter the Team ID of your Developer Account. You can access this information under the Membership page when you log in to http://developer.apple.com. You can access your Key ID value from the page that comes up when you create your P8 certificate. You should not lose your P8 certificate. You are only allowed to download once. Otherwise, you must create a new one.

As a platform, if you are going to work in the test application (Debug Mod application opened only through XCode), choose Test. Choose Prod if you are going to work on a live application (available in Testflight or published in the AppStore).

You can enter any value you want as the App Alias ​​value without using Turkish characters and spaces. The general usage example is as follows: related_digital_ios

 

Copyright 2020 Related Digital