The core initialization consists of only steps 1, 2 and 3, but we recommend doing steps 4, 5 and 6 too. Once the above initialization is done you can start tracking user behavior.
Step 1: Add the RSKit source to your XCode project.
The IOS SDK can be downloaded here. The RSKit source is located at RSKit/RSKit in the repository.
We recommend also including AdSupport.framework in the link phase as well. When AdSupport is available, RSKit includes the quasi-global "advertiser" device ID with tracking messages. Otherwise, RSKit falls back on the vendor-specific device ID.
Step 2: Initialize RSKit at runtime.
The preferred place to do this is in your AppDelegate's `applicationDidFinishLaunchingWithOptions` method, but it can be done elsewhere if you prefer.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Step 3: Include the RSClient header.
Step 4: Set user identifiers.
If your app has a unique key that can identify the current user, we recommend sharing it with RSKit. We also suggest setting the user after initialization is done:
[RSClient sharedClient].userId = @"user12345";
Step 5: Assign session identifiers.
In some cases, it is appropriate to assign an identifier to the current RSKit session. For example, if the user has been deep-linked into the app via an offer email or web page.
RSKit sessions have temporal validity intervals, which are expressed as NSTimeIntervals (i.e., seconds). Session identifiers are persisted to disk and are included in all subsequent tracking messages, including following application termination and relaunch, until they expire.
[[RSClient sharedClient] setSessionId:@"session12345" expiresIn:(60*60*24*7)];
Step 6: Use location awareness.
If your app employs location services, you can share that data with Retention Science. RSKit doesn't start location updates on its own, but if you share a CLLocationManager instance with RSKit, RSKit includes the most recent location data on subsequent tracking messages.
Let's say you have a CLLocationManager instance called _locationManager, and you start location updates:
[RSClient sharedClient].locationManager = _locationManager;
When you stop location updates, it's a good idea to set the RSClient locationManager property to nil. This is because even accessing stale location data from a CLLocationManager instance causes the location services icon to appear on the device's status bar, which may be misleading to users in some situations.
[RSClient sharedClient].locationManager = nil;
Now, the RSClient should be accessible within your project.