Download IOS SDK


There are different steps to integrate for Objective C and Swift as explained below.

You can contact us on support@tagnpin.com if any assistance is required.
SDK source can be downloaded from here.

Download IOS SDK

A. Integration for Objective C code


Follow the steps below

  1. Download the sdk (.a file), header file (.h file), and 4 icons (facebook.png, gmail.png, twitter.png, WhatsApp.png) from sdk download link and include them into your project. Simply drag and include them in your project.

  2. Add "Social" and "MessageUI" frameworks in your App.

  3. Open info.plist of your project as source code (right click on info.plist and click on Open as >> Source code) and add the following code in it.

    Select All

            <key>NSAppTransportSecurity</key>
                <dict>
                    <key>NSAllowsArbitraryLoads</key>
                    <true/>
                    <key>NSExceptionDomains</key>
                <dict/>
            </dict>
            <key>CFBundleURLTypes</key>
            <array>
                <dict>
                    <key>CFBundleURLName</key>
                    <string>"Your Project Identifier Name" </string>
                    <key>CFBundleURLSchemes</key>
                    <array>
                            <string>"yourURLscheme"</string>
                    </array>
                </dict>
            </array>
                <key>LSApplicationQueriesSchemes</key>
            <array>
                <string>whatsapp</string>
        </array>
    
        
    OR

    You can simply open the info.plist and add the keys which works as same as above for this.

    • 3.1. Add a new row by going to the menu and clicking Editor > Add Item. Setup a NSAppTransportSecurity as a Dictionary.

    • 3.2. Added a Subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES as like following image.


    • 3.3. Add a new row again and set up a URL Types item by adding a new item. Expand the URL Types key, expand Item 0, and add a new item, URL schemes. Fill in "appScheme" for Item 0 of URL schemes and your company identifier for the URL Identifier. Your file should resemble the image below when done.


    • 3.4. Add a new row again and set up a LSApplicationQueriesSchemes as an Array. Fill in "whatsapp" for Item 0 as like following image.


  4. Include the header file in .m file in which sdk function is to be accessed

    Select All

    
    #import "InviteReferrals.h"
            
            

  5. Call the following function in your AppDelegate openURL function that will check the deep linking and open your app from URL Scheme.

    Select All

    
    -(BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation {
    [InviteReferrals application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
    return YES;
    }
            
     
            

  6. Initialize the sdk in applicationDidBecomeActive function. You should be Logged into Invitereferrals account to see the correct values of BRANDID and ENCRYTEDKEY.

    Select All

    
     - (void)applicationDidBecomeActive:(UIApplication *)application {    
                    [InviteReferrals setupWithBrandId:52X 
                    encryptedKey:@"6F969A60F73C2218B6913465A5194CFC"];
                }
    
           
            

  7. Call the set up user function that will check the auto user login.

    Select All

    
    [InviteReferrals setupUserID:customerEmail mobile:nil name:nil gender:nil shareLink:nil shareTitle:nil shareDesc:nil shareImg:nil customValue:nil campaignID:nil flag:nil];
               
                 Example:
                [InviteReferrals setupUserID: @”abc@xyz.com" mobile:nil name:nil gender:nil shareLink:nil shareTitle:nil shareDesc:nil shareImg:nil customValue:nil campaignID:nil flag:nil];
            
    
               
            

  8. Call the welcome message function to display personalized welcome message to a friend coming through referral.

    Select All

    
     [InviteReferrals welcomeMessage];
             
            

  9. Open referral program view on Button action. Include following code to display the referral program. You may specify a campaignID. Default campaignID will be applied in case no campaignID is passed.

    Select All

    
     [InviteReferrals launch: CAMPAIGNID Email:CustomerEmail mobile:nil name:nil];
    
                Example:
                [InviteReferrals launch:@”6823” Email:@”test@invitereferrals.com” mobile:nil name:nil];
    
            

  10. Call the following function in the viewDidLoad function of different view .m files. You may then set rules in the inviteReferrals campaign settings to show campaign popup after specific time delay or after specific number of App launches on this view

    Select All

    
     [InviteReferrals showSharePopup:@"XXXXX" Email:email mobile:nil name:nil];
                Example:
                [InviteReferrals showSharePopup:@"home" Email:@”abc@gmail.com” mobile:nil name:nil];
    
            

  11. Use following function for tracking event. EVENT_NAME and ORDERID are mandatory and other parameters are optional. EVENT_NAME can be "register", "sale", or "install". ORDERID can be nil in case of "install" event, otherwise it should be some unique value associated with conversion like transactionid or Email.

    Select All

    
    [InviteReferrals tracking:@"EVENT_NAME" 
                        orderID:@"ORDERID" purchaseValue:nil 
                        email:nil mobile:nil name:nil];  
    
                Example             
                [InviteReferrals tracking:@"register"
                        orderID:@"abc@xyz.com" purchaseValue:nil 
                        email:nil mobile:nil name:nil]; 
               [InviteReferrals tracking:@"sale" orderID:@"13568" 
                        purchaseValue:nil 
                        email:nil mobile:nil name:nil];
                [InviteReferrals tracking:@"install" orderID:nil purchaseValue:nil  
                        email:nil mobile:nil name:nil];  
         
            

  12. You can also auto enroll the user in referral program with following function. User will directly skip to the second option to refer friends. Replace NAME and EMAIL with the respective values

    Select All

    
    [InviteReferrals setupUserID:@"EMAIL" mobile:nil name:nil gender:nil
                        shareLink:nil shareTitle:nil shareDesc:nil shareImg:nil customValue:nil campaignID:nil flag:nil];
    
                Example
                [InviteReferrals setupUserID:@"abc@xyz.com" mobile:nil name:nil gender:nil
                        shareLink:nil shareTitle:nil shareDesc:nil shareImg:nil customValue:nil campaignID:nil flag:nil];
            
            

Localise Language:-

  1. For Vietnamese:

        For Localise language such as Vietnamese follow the following steps.

    • a. Select your Project in left panel and select the Project in the next pane (NOT the Target), and under the Info tab you’ll see a section for Localizations. Click the + and choose Vietnamese (vi).

    • b. The next screen asks you which files you want to localize. Keep them all selected and click Finish. Note:Localizable.strings will not show up in this list, so don’t panic! At this point, Xcode has set up some directories, behind the scenes, containing separate versions of InfoPlist.strings and Main.storyboard for each language you selected.

    • c. Add a new file Go to File>>New>>File. Choose Strings File unders the Resource subsection. Click Next, name the file Localizable.strings, then click Save.
      Note: Localizable.strings is the default filename iOS uses for localized text. Resist the urge to name the file something else, otherwise you will have to type the name of your .strings file every time you reference a localized string.

    • d. To let Xcode know you want it localized, select the file using the left pane, and open the File Inspector in the right pane. There you will see a button labeled Localize, click it, choose English (because it’s currently in English), and finally click Localize.

    • e. Now ensure that both english and Vietnamese are selected in Localization in the file inspector on right pane in xcode.


    • f. Go back to the left panel and click on the arrow next to Localizable.strings, so it shows the sub-elements. You now have two versions of this file: one for English and the other for Vietnamese:


    • g. Select Localizable.strings (English) and replace its contents with the following:

      Select All

      
       "Done" = "Done";
                      "OK" = "OK";
                      "Please enter your email." = "Please enter your email.";
                      "Press OK to continue" = "Press OK to continue";
                      "Please enter a valid email." = "Please enter a valid email.";
                      "Invalid authentication" = "Invalid authentication";
                      "Enter your name" = "Enter your name";
                      "Enter your Email" = "Enter your Email";
                      "Enter the Referral Program" = "Enter the Referral Program";
                      "How it works" = "How it works";
                      "Terms & Conditions" = "Terms & Conditions";
                      "Facebook not Logged In." = "Facebook not Logged In.";
                      "Please login to your facebook account first." = "Please login to
                       your facebook account first.";
                      "Twitter not Logged In." = "Twitter not Logged In.";
                      "Please login to your twitter account first." = "Please login to 
                         your twitter account first.";
                      "WhatsApp not installed." = "WhatsApp not installed.";
                      "Your device does not have WhatsApp installed." = "Your device does not
                        have WhatsApp installed.";
                      "Can not Send Mail" = "Can not Send Mail";
                      "Please login to your email account first." = "Please login to 
                       your email account first.";
                      "More options to share" = "More options to share";
                      "My Referral Statistics" = "My Referral Statistics";
      
      
                  

    • h. To change the text for Vietnamese,Select Localizable.strings (Vietnamese) and replace its contents with the following:

      Select All

      
        "Done" = "Làm xong";
                      "OK" = "được";
                      "Please enter your email." ="Vui lòng điền email của bạn .";
                      "Press OK to continue" = "Nhấn OK để tiếp tục";
                      "Please enter a valid email." = "Vui lòng nhập email hợp lệ.";
                      "Invalid authentication" = "xác thực không hợp lệ";
                      "Enter your name" = "Nhập tên của bạn";
                      "Enter your Email" = "Nhập email của bạn";
                      "Enter the Referral Program" = "Nhập Chương trình giới thiệu";
                      "How it works" = "Làm thế nào nó hoạt động";
                      "Terms & Conditions" = "Điều khoản và điều kiện";
                      "Facebook not Logged In." = "Facebook không Logged In.";
                      "Please login to your facebook account first." = "Xin hãy đăng nhập 
                         vào tài khoản facebook của bạn đầu tiên .";
                      "Twitter not Logged In." = "Twitter không Logged In.";
                      "Please login to your twitter account first." = "Xin hãy đăng nhập vào 
                         tài khoản twitter của bạn đầu tiên .";
                      "WhatsApp not installed." = "WhatsApp không được cài đặt .";
                      "Your device does not have WhatsApp installed." = "WhatsApp không được 
                         cài đặt .";
                      "Can not Send Mail" = "Không thể Gửi Mail";
                      "Please login to your email account first." = "Xin hãy đăng nhập vào 
                          tài khoản email của bạn đầu tiên .";
                      "More options to share" = "Nhiều tùy chọn để chia sẻ";
                      "My Referral Statistics" = "Thống kê giới thiệu của tôi";
      
      
                   
                  



B. Integration for SWIFT code


Follow the steps below

  1. Download the sdk (.a file), header file (.h file), and whatsapp@2x.png from sdk download link and include them into your project. Simply drag and include them in your project

  2. Add “Social” and “MessageUI” frameworks in your App.

  3. Open info.plist of your project as source code (right click on info.plist and click on Open as >> Source code) and add the following code in it.

    Select All

    
    <key>NSAppTransportSecurity</key<
      <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSExceptionDomains</key>
            <dict/>
      </dict>
      <key>CFBundleURLTypes</key>
      <array>
            <dict>
                    <key>CFBundleURLName</key>
            <string>"Your Project Identifier Name" </string>
                    <key>CFBundleURLSchemes</key>
                    <array>
                            <string>"yourURLscheme"</string>
                    </array>
            </dict>
      </array>
      <key>LSApplicationQueriesSchemes</key>
      <array>
                 <string>whatsapp</string>
        </array>
    
         
        
    OR

    • 3.1. Open info.plist of your project as source code (right click on info.plist and click on Open as >> Source code) and add the following code in it.

    • 3.2. Added a Subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES as like following image.


    • 3.3. Add a new row again and set up a URL Types item by adding a new item. Expand the URL Types key, expand Item 0, and add a new item, URL schemes. Fill in "appScheme" for Item 0 of URL schemes and your company identifier for the URL Identifier. Your file should resemble the image below when done.


    • 3.4. Add a new row again and set up a LSApplicationQueriesSchemes as an Array. Fill in “whatsapp” for Item 0 as like following image.



  4. Add a new header file and name it with following format
    YOUR_PROJECT_NAME-Bridging-Header.h

    Example if your project name is test. Then the header file name will be
    test-Bridging-Header.h

    Now add the following import statement in YOUR_PROJECT_NAME-Bridging-Header.h for accessing Native SDK Classes

    Select All

    
    #import "InviteReferrals.h"
    
           
            

    Make sure that the path of bridge-header.h file is included in build settings under “Swift compiler - code generation” as
    Objective C bridging header : YOUR_PROJECT_NAME/YOUR_PROJECT_NAME-Bridging-Header.h.h


  5. Call the following function in your AppDelegate openURL function that will check the deep linking and open your app from URL Scheme.

    Select All

    
      func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    InviteReferrals.application(application openURL:url sourceApplication:sourceApplication annotation:annotation)
    return true
    }
     
        

  6. Initialize the sdk in applicationDidBecomeActive function. You should be Logged into Invitereferrals account to see the correct values of BRANDID and ENCRYTEDKEY.

    Select All

    
    func applicationDidBecomeActive(application: UIApplication) {        
                InviteReferrals.setupWithBrandId(52X, encryptedKey: "6F969A60F73C2218B6913465A5194CFC")
            }
    
            

  7. Call the set up user function that will check the auto user login.

    Select All

                InviteReferrals.setupUserID(“Email”, mobile: nil, name: nil,
                 gender: nil, shareLink: nil, shareTitle: nil, shareDesc: nil,
                 shareImg: nil, customValue: nil, campaignID: nil, flag: nil)
                 
                Example:
                InviteReferrals.setupUserID(“abc@xyz.com”, mobile: nil, name: nil,
                 gender: nil, shareLink: nil, shareTitle: nil, shareDesc: nil, 
                shareImg: nil, customValue: nil, campaignID: nil, flag: nil)
             
            

  8. Call the welcome message function to display personalized welcome message to a friend coming through referral.

    Select All

                InviteReferrals.welcomeMessage()           
            

  9. Open referral program view on Button action. Include following code to display the referral program. You may specify a campaignID. Default campaignID will be applied in case no campaignID is passed.

    Select All

    
    InviteReferrals.launch("CAMPAIGNID",Email:”Email”, mobile: nil, name: nil)
    
                Example
                InviteReferrals.launch(nil);
                InviteReferrals.launch("6823", Email:”abc@xyz.com”, mobile: nil, name: nil)            
           
            

  10. Call the following function in the viewDidLoad function of different view .m files. You may then set rules in the inviteReferrals campaign settings to show campaign popup after specific time delay or after specific number of App launches

    Select All

    
    InviteReferrals.showSharePopup("XXXX", email: Email, mobile:nil, name: nil)
                Example:
                InviteReferrals.showSharePopup("home", email: Email, mobile:nil, name: nil)
    
            

  11. Use following function for tracking event. EVENT_NAME and ORDERID are mandatory and other parameters are optional. EVENT_NAME can be "register", "sale", or "install". ORDERID can be nil in case of "install" event, otherwise it should be some unique value associated with conversion like transactionid or Email.

    Select All

     
    
    InviteReferrals.tracking("EVENT_NAME", orderID: "ORDERID", purchaseValue:nil, email:nil, mobile:nil, name:nil)           
    
                Example
                InviteReferrals.tracking("register", orderID: "abc@xyz.com", 
                purchaseValue:nil, email:nil, mobile:nil, name:nil)
                InviteReferrals.tracking("sale", orderID: "13568", purchaseValue:nil,
                 email:nil, mobile:nil, name:nil)
                InviteReferrals.tracking("install", orderID:nil, purchaseValue:nil,
                 email:nil, mobile:nil, name:nil)
     
            

  12. You can also auto enroll the user in referral program with following function. User will directly skip to the second option to refer friends. Replace NAME and EMAIL with the respective values

    Select All

    
    InviteReferrals.setupUserID("EMAIL",  mobile:nil, name:"NAME", gender:nil,
                        shareLink:nil, shareTitle:nil, shareDesc:nil, shareImg:nil, customValue:nil,campaignID: nil, flag: nil)
    
                Example
                InviteReferrals.setupUserID("mike@test.com", mobile:nil, name:"Mike", gender:nil,
                        shareLink:nil, shareTitle:nil, shareDesc:nil, shareImg:nil, customValue:nil, campaignID: nil, flag: nil)
    
            

Localise Language:-

  1. For Vietnamese:

        For Localise language such as Vietnamese follow the following steps.

    • a. Select your Project in left panel and select the Project in the next pane (NOT the Target), and under the Info tab you’ll see a section for Localizations. Click the + and choose Vietnamese (vi).

    • b. The next screen asks you which files you want to localize. Keep them all selected and click Finish. Note:Localizable.strings will not show up in this list, so don’t panic! At this point, Xcode has set up some directories, behind the scenes, containing separate versions of InfoPlist.strings and Main.storyboard for each language you selected.

    • c. Add a new file Go to File>>New>>File. Choose Strings File unders the Resource subsection. Click Next, name the file Localizable.strings, then click Save.
      Note: Localizable.strings is the default filename iOS uses for localized text. Resist the urge to name the file something else, otherwise you will have to type the name of your .strings file every time you reference a localized string.

    • d. To let Xcode know you want it localized, select the file using the left pane, and open the File Inspector in the right pane. There you will see a button labeled Localize, click it, choose English (because it’s currently in English), and finally click Localize.

    • e. Now ensure that both english and Vietnamese are selected in Localization in the file inspector on right pane in xcode.


    • f. Go back to the left panel and click on the arrow next to Localizable.strings, so it shows the sub-elements. You now have two versions of this file: one for English and the other for Vietnamese:


    • g. Select Localizable.strings (English) and replace its contents with the following:

      Select All

      
        "Done" = "Done";
                      "OK" = "OK";
                      "Please enter your email." = "Please enter your email.";
                      "Press OK to continue" = "Press OK to continue";
                      "Please enter a valid email." = "Please enter a valid email.";
                      "Invalid authentication" = "Invalid authentication";
                      "Enter your name" = "Enter your name";
                      "Enter your Email" = "Enter your Email";
                      "Enter the Referral Program" = "Enter the Referral Program";
                      "How it works" = "How it works";
                      "Terms & Conditions" = "Terms & Conditions";
                      "Facebook not Logged In." = "Facebook not Logged In.";
                      "Please login to your facebook account first." = "Please login to
                       your facebook account first.";
                      "Twitter not Logged In." = "Twitter not Logged In.";
                      "Please login to your twitter account first." = "Please login to 
                         your twitter account first.";
                      "WhatsApp not installed." = "WhatsApp not installed.";
                      "Your device does not have WhatsApp installed." = "Your device does not
                        have WhatsApp installed.";
                      "Can not Send Mail" = "Can not Send Mail";
                      "Please login to your email account first." = "Please login to 
                       your email account first.";
                      "More options to share" = "More options to share";
                      "My Referral Statistics" = "My Referral Statistics";
      
                  

    • h. To change the text for Vietnamese,Select Localizable.strings (Vietnamese) and replace its contents with the following:

      Select All

      
        "Done" = "Làm xong";
                      "OK" = "được";
                      "Please enter your email." ="Vui lòng điền email của bạn .";
                      "Press OK to continue" = "Nhấn OK để tiếp tục";
                      "Please enter a valid email." = "Vui lòng nhập email hợp lệ.";
                      "Invalid authentication" = "xác thực không hợp lệ";
                      "Enter your name" = "Nhập tên của bạn";
                      "Enter your Email" = "Nhập email của bạn";
                      "Enter the Referral Program" = "Nhập Chương trình giới thiệu";
                      "How it works" = "Làm thế nào nó hoạt động";
                      "Terms & Conditions" = "Điều khoản và điều kiện";
                      "Facebook not Logged In." = "Facebook không Logged In.";
                      "Please login to your facebook account first." = "Xin hãy đăng nhập 
                         vào tài khoản facebook của bạn đầu tiên .";
                      "Twitter not Logged In." = "Twitter không Logged In.";
                      "Please login to your twitter account first." = "Xin hãy đăng nhập vào 
                         tài khoản twitter của bạn đầu tiên .";
                      "WhatsApp not installed." = "WhatsApp không được cài đặt .";
                      "Your device does not have WhatsApp installed." = "WhatsApp không được 
                         cài đặt .";
                      "Can not Send Mail" = "Không thể Gửi Mail";
                      "Please login to your email account first." = "Xin hãy đăng nhập vào 
                          tài khoản email của bạn đầu tiên .";
                      "More options to share" = "Nhiều tùy chọn để chia sẻ";
                      "My Referral Statistics" = "Thống kê giới thiệu của tôi";