Skip to main content

RapidoReach iOS Integration Guide

Get Your API Key​

Sign-up for a new developer account and create a new iOS app here and copy your API Key.

Install SDK​

Install via Cocoapods (easiest)

    pod 'RapidoReachSDK', ‘1.0.2’

To install

  pod install

Flags​

On the Build Settings tab and type in Other Linker Flags in the search field. Add the following flags. -ObjC

Set Required Build Settings​

We utilize Apple's Advertising ID (IDFA) to identify users. When uploading your app we recommend that you check all the boxes to note that your app uses IDFA and receives a smooth approval process. On the Info tab add in a Dictionary called NSAppTransportSecurity. Make sure you add this dictionary on the Top Level Key. Inside this dictionary, add a Boolean called NSAllowsArbitraryLoads and set it to YES. An example of your info.plist can be found here.

Initialize​

After you have finished modifying the project settings, open your AppDelegate.swift file and import the RapidoReach SDK. Replace the YOUR_API_TOKEN with the actual api key found on your app. Replace YOUR_USER_ID with your unique ID for your appuser. If you do not have a unique user ID we recommend just using their Apple Advertising ID (IDFA). If you utilize a server-side callback, this is the user ID that will be passed back to you when a user earns a reward.

// AppDelegate.swift
import RapidoReachSDK

Next initialize the RapidoReach SDK in your applicationDidFinishLaunchingWithOptions method.

// AppDelegate.swift

static let RapidoReachAPIKey = "<YOUR_API_TOKEN>"
static let RapidoReachUSER = "<YOUR_USER_ID>"

RapidoReach.shared.configure(apiKey: AppDelegate.RapidoReachAPIKey, user: AppDelegate.RapidoReachUSER)

Reward Center​

Open the .swift file of the controller where you want your users to have access to RapidoReach Reward Center. Call the presentSurvey method when you are ready to the send the user into the reward center where they can complete surveys in exchange for your virtual currency. We automatically convert the amount of currency a user gets based on the conversion rate specified in your app.

// ViewController.swift
// Import rapidoreach SDK
import RapidoReachSDK

// Call for AppUserId
// Do any additional setup after loading the view, typically from a nib.
RapidoReach.shared.delegate = self
// Fetch userId
RapidoReach.shared.fetchAppUserID()

// Start reward center
RapidoReach.shared.setNavigationBarText(for: "Rapidoreach")
RapidoReach.shared.presentSurvey()

Reward Callback​

To ensure safety and privacy, we notify you of all awards via a server side callback. In the developer dashboard for your App add the server callback that we should call to notify you when a user has completed an offer. Note the user ID pass into the initialize call will be returned to you in the server side callback. More information about setting up the callback can be found in the developer dashboard.

The quantity value will automatically be converted to your virtual currency based on the exchange rate you specified in your app. Currency is always rounded in favor of the app user to improve happiness and engagement.

Client Side Award Callback​

For security purposes we always recommend that developers utilize a server side callback, however we also provide APIs for implementing a client side award notification if you lack the server structure or a server altogether or want more real-time award notification. It's important to only award the user once if you use both server and client callbacks (though your users may not be opposed!).

import RapidoReach

extension ViewController: RapidoReachDelegate {
func didSurveyAvailable(_ available: Bool) {
print("ROR: Surveys available "+(available ? "Available" : "Not Available"));
}


func didOpenRewardCenter() {
print("didOpenRewardCenter")
}

func didClosedRewardCenter() {
print("didClosedRewardCenter")
}

func didGetRewards(_ reward: RapidoReachReward) {
print("RapidoReach Rewards Available: \(reward.total_rewards)")
self.user?.rewards = reward
self.bindReward()
}

func didGetError(_ error: RapidoReachError) {
print("didGetError: "+error.localizedDescription)
}

}

Testing SDK​

When you initially create your app we automatically set your app to Test mode. While in test mode a survey will always be available. Note - be sure to set your app to Live in your dashboardt before your app goes live or you won't serve any real surveys to your users!

Customizing SDK​

We provide several methods to customize the navigation bar to feel like your app.

  RapidoReach.shared.setNavigationBarColor(for: "#00796B")
RapidoReach.shared.setNavigationBarTextColor(for: "#FFFFFF")
RapidoReach.shared.setStatusBarStyle(for: "light") // 'light' or 'dark' depending on what color of Navigation Bar is selected

Check out a video tutorial for detail explaination​