iOS SDK- Smart Deep Link Creation

Prerequisites

  • Installing SDK
  • import Appgain/Appgain.h

Steps to Follow:

Add your smart deep link values:

  • Name: give an identifier for your smart deep link, you might want to use it when creation a deep page.

  • Description: describe your smart link for social representation.

  • Android target: when your smart link is opened from android device, you have to choose a primary link for the users to be directed to, and in case this primary link is not working, the secondary link should open.

  • IOS target: when your smart link is opened from iOS device, you have to choose a primary link for the users to be directed to, and in case this primary link is not working, the secondary link should open. Note that both the primary and fallback links are mandatory, also they can be just simple URLS or deep links.

  • Web URL: when your smart link is opened from a PC, you have to choose where does the smart link shall direct the user.

Code:

-- create target objects for different platform (ios,android,web)

   TargetPlatform *web = [[TargetPlatform new] initWithPrimary: <https://google.com withFallBack:@""];

    TargetPlatform *android = [[TargetPlatform new] initWithPrimary:<https://google.comwithFallBack:<https://youtube.com];

    TargetPlatform *ios = [[TargetPlatform new] initWithPrimary:<https://google.com withFallBack: <https://youtube.com];

// best things to know you not need to worry about thread add this things run in background thread
//and response and result come back to you in main thread to update for user data.

-- create smart link object

     SmartDeepLink *smartObject = [[SmartDeepLink new] initWithHeader:@"hello"                  andImage:<Your-image-url> andDescription:<your-description> andName:<name-text> iosTarget:<ios-target-object> androidTarget:<android-target-object> webTarget:<web-target-object>];

    [smartObject setSlug:@“your slug”]; ///optional
    [AppGain CreateSmartLinkWithObject:smartObject whenFinish:^ (NSURLResponse * response, NSMutableDictionary * result) {
///run response and result back in main thread
///response
//result

}];

swift

let webTarget : TargetPlatform = TargetPlatform.init(primary: <your primary , withFallBack: <fallback of it )
let smartObject : SmartLinkObject = SmartDeepLink.init(header: <#T##String!#, andImage: <#T## url String!#, andDescription: <#T##String!#, andName:<#T##String!#, iosTarget: <#T##TargetPlatform!#,androidTarget: <#T##TargetPlatform!#, webTarget: <#T##TargetPlatform!#)

AppGain.createSmartLink(with: smartObject!) {(response, result) in
        //result and response is thread safe


}