Follow the below steps to integrate the iOS library from source with an Objective-C project.
If you haven’t already, install the latest version of CocoaPods.
pod init
Add this line to your Podfile:
pod 'nSure'
Run the following command:
pod install
Import “NSure.h” into AppDelegate.m, and initialize nSure within application:didFinishLaunchingWithOptions:
#import <nSure/nSure.h>
- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[NSure sharedInstanceWithAppID:@"iOS_OBJC_SAMPLE_APP_ID" partherID:@"PARTNER_ID"];
}
The sdk exposes a property "deviceId" on NSure.sharedInstance and one can use this property to retrieve the device id.
The merchant has to retrieve the device id from the sdk and pass it to the merchant's server. The merchant's server has to add this device id in every call to nSure servers. The request body should contain the device id under a property called sessionInfo. For example sessionInfo:
{ "deviceId": "user-device-id" }
Objective-C property access:
NSure.sharedInstance.deviceId
Follow the below steps to integrate the iOS library from source with an Swift project.
If you haven’t already, install the latest version of CocoaPods.
pod init
Add this line to your Podfile:
pod 'nSure'
Run the following command:
pod install
Import “nSure” module into AppDelegate.swift, and initialize nSure within application:didFinishLaunchingWithOptions:
import nSure
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
NSure.sharedInstance(withAppID: "iOS_SWIFT_SAMPLE_APP_ID", partherID: "PARTNER_ID")
}
The sdk exposes a property "deviceId" on NSure.sharedInstance and one can use this property to retrieve the device id.
The merchant has to retrieve the device id from the sdk and pass it to the merchant's server. The merchant's server has to add this device id in every call to nSure servers. The request body should contain the device id under a property called sessionInfo. For example sessionInfo:
{ "deviceId": "user-device-id" }
Swift property access:
NSure.sharedInstance.deviceId