iOS sdk


Мы предаставляем нативное андроид сдк, с помощью которого вы можете организовать всестороннюю поддержку ваших польхователей. С возможностью показа фака и контакта с сапортом по средствам онлайн\оффлайн чата. С пуш нотификациями и логированием действий пользователя.



Installation



We recommend you use cocoa pods to install Inapphelp and its dependencies. Dependencies include AFNetworking 2.0 and JCNotificationBannerPresenter 1.1.2


pod 'HelpStack'

Also you can download sources



Integration


Initializing


We identifies your App with three params:

App id    - Unique app id.

App key - Unique app key.

Domain - Your inapphelp company domain name.

To get this params navigate to Settings -> integration in your admin panel.


To initialize inapphelp:

[[IAHHelpDesk instance] initWithCompanyName:@"" withAppId:@"" withAppKey:@""]

Optional you can set your custom user id (To identificate user in your system).

[[IAHHelpDesk instance] setUserId:(NSString *)];

And user secret key, to allow issues only from signed users. Secret key it is userid signed by your own server. Learn more about secure concept

[[IAHHelpDesk instance] setUserSecret:(NSString *)];

Using


Inapphelp is now integrated. To show a help using the -(void)showHelp:(UIViewController*)parentController;

- (IBAction)openSupport:(UIButton *)button
{
    [[IAHHelpDesk instance] showHelp:self];
}

Push notifications


First, setup your application with Apple and prepare certificates. Create certificates

After you got cert.cer and private.p12 generate new .p12 by there steps:

Convert the developer certificate file you receive from Apple into a PEM certificate file:

openssl x509 -in cert.cer -inform DER -out cert.pem -outform PEM

Сonvert .p12 it into a PEM key:

openssl pkcs12 -nocerts -in key.p12 -out key.pem

Now generate a valid P12 file, based on the key and the PEM version of the iPhone developer certificate:

openssl pkcs12 -export -inkey key.pem -in cert.pem -out upload.p12

All right. We are almost at the end. Now you need to enable ios pushes in your admin panel.

Go to your admin panel - > settings -> applications and click on the app. Set ios push notification state to 'On', upload certificate select push mode and upload a cert.


Okay go to your application.

To provide push token to our backend you need invoke setPushToken: from inside the application delegate method application:didRegisterForRemoteNotificationsWithDeviceToken:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken  {
    [[IAHHelpDesk instance] setPushToken:deviceToken];
}

For open conversation window if user come to the app from push or to display inapp notification on new answer you need to modify your AppDelegate.m

When app starts from push notification:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ... // Override point for customization after application launch.
    if (launchOptions != nil)
    {
        NSDictionary *pushNotification = [launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
        if (pushNotification != nil)
        {
            if ([[pushNotification objectForKey:@"source"] isEqualToString:@"inapphelp"]) {
                [[IAHHelpDesk instance] handlePush:pushNotification withViewController:self.window.rootViewController launchedFromPush:YES];
            }
        }
    }
    return YES;
}

And when app recive push while running:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    UIApplicationState state = [application applicationState];
    if ([[userInfo objectForKey:@"source"] isEqualToString:@"inapphelp"]) {
        [[IAHHelpDesk instance] handlePush:userInfo withViewController:self.window.rootViewController launchedFromPush:state != UIApplicationStateActive];
    }
}