Update Your App Delegate

Now that all the required frameworks have been added to your project, you need to implement them in the code base.

This section outlines how to implement the frameworks in the code base, using either Objective_C or Swift.


Info Please make sure you have already completed the following steps:

  • Retrieve the YOUR_APP_KEY and YOUR_APP_GROUP_KEY values from the HurreeSDK website – it is required for the instructions below
  • Initialize HurreeSDK in your application's main thread with four actions in the didRegisterForRemoteNotificationsWithDeviceToken (Objective-C):
    • Initialise the AnalyticsSingleton Object
    • Call deportKeyValues function with the required keys
    • Call deportUserValues function with required keys
    • Call sendLoginDetails


Info Please note that YOUR_OBJECT_NAME refers to an object name of your choice.


To update your app delegate

Using Objective-C

Add the following three lines of code to the top of your AppDelegate.h file:

The first two lines contain the bridging heading that imports the SDK for an Objective-C project:

#import Your_Project_Name-Bridging-Header.h
#import <HurreeSDK/HurreeSDK-Swift.h>;
#import <HurreeSDK/HurreeAnalytics.h>;

The final line contains the property:

@property(nonatomic, strong) AnalyticsSingleton *YOUR_OBJECT_NAME

Add the following lines of code (including YOUR_APP_KEY and YOUR_APP_GROUP_KEY values) to the application:didRegisterForRemoteNotificationsWithDeviceToken method in your AppDelegate.m file:

This enables the application to start the SDK, start the login process and receive push notifications from the server:

[YOUR_OBJECT_NAME deportKeyValues: YOUR_APP_GROUP_KEY 
    app_key: YOUR_APP_KEY 
    uniqueUserID: USER_ID 
    deviceTokenString: DEVICE_TOKEN_STRING 
    timerValue: TIME_VALUE 
    isiOSNative:BOOL_IOS_VALUE];

[YOUR_OBJECT_NAME deportUserValues: FIRSTNAME 
    lastName:LASTNAME 
    email:EMAIL_ADDRESS 
    userImageURL:IMAGE_URL 
    gender:USER_GENDER 
    dateOfBirth:DOB_VALUE
];

[YOUR_OBJECT_NAME sendLoginDetails:^(id result) {
    //Print Result
}];

Using Swift

Add following line of code to the application(_:didRegisterForRemoteNotificationsWithDeviceToken:) method in your AppDelegate.swift file:

This enables the application to start the SDK, start the login process and receive push notifications from the server:

let YOUR_OBJECT_NAME = AnalyticsSingleton.sharedInstance()
YOUR_OBJECT_NAME.deportKeyValues(YOUR_APP_GROUP_KEY, app_key: YOUR_APP_KEY, uniqueUserID: USER_ID, deviceTokenString:DEVICE_TOKEN_STRING, timerValue:TIME_VALUE, isiOSNative:BOOL_IOS_VALUE)
YOUR_OBJECT_NAME.deportUserValues(FIRSTNAME, lastName:LASTNAME, email:EMAIL_ADDRESS, userImageURL:IMAGE_URL, gender:USER_GENDER, dateOfBirth:DOB_VALUE)
YOUR_OBJECT_NAME.sendLoginDetails{(result) in 
    //Print Result
}

results matching ""

    No results matching ""