Skip to main content

iOS - Installation & Integration

Requirements

iOS 15.0+

Installation

  1. Add the private repository:

    #open terminal
    pod repo add YuuSDK https://bitbucket.org/dfi-pdd/yuu-ios-sdk-podspecs.git
  2. Edit Podfile:

    #Edit Podfile
    #Add these codes to the top of the Podfile
    platform :ios, '15.0'
    source 'https://bitbucket.org/dfi-pdd/yuu-ios-sdk-podspecs.git'
    use_frameworks!
    #Add these codes under your target(s)
    target '<YOUR_TARGET_NAME>' do
    pod 'YuuSDK'
    end
  3. Pod install

    #open terminal
    pod install --repo-update

Integration

Init SDK

Add the Configuration plist.

  1. Add YuuSDK-Info.plist to your Xcode project with the following content, client key and banner code and tag the plist to your corresponding environment (SIT/PROD) target.

    SIT

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>ENVIRONMENT</key>
    <string>SIT</string>
    <key>CLIENT_ID</key>
    <string><YOUR_SIT_CLIENT_ID></string>
    <key>BANNER_CODE</key>
    <string><YOUR_BANNER_CODE></string>
    <key>TEAM_ID</key>
    <string><YOUR_TEAM_ID></string>
    <key>BUNDLE_ID</key>
    <string><YOUR_BUNDLE_ID></string>
    <key>CALL_BACK_URL_SCHEME</key>
    <!---to call back your app--->
    <string><YOUR_SIT_CALL_BACK_URL_SCHEME></string>
    </dict>
    </plist>

    PROD

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>ENVIRONMENT</key>
    <string>PROD</string>
    <key>CLIENT_ID</key>
    <string><YOUR_PROD_CLIENT_ID></string>
    <key>BANNER_CODE</key>
    <string><YOUR_BANNER_CODE></string>
    <key>TEAM_ID</key>
    <string><YOUR_TEAM_ID></string>
    <key>BUNDLE_ID</key>
    <string><YOUR_BUNDLE_ID></string>
    <key>CALL_BACK_URL_SCHEME</key>
    <!---to call back your app--->
    <string><YOUR_PROD_CALL_BACK_URL_SCHEME></string>
    </dict>
    </plist>
  2. You can add your plist path with the above plist format.

    //swift
    //Add sdk config method to your `AppDelegate.swift`
    import YuuSDK
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    if let plistPath = Bundle.main.path(forResource: "YuuSDK-Info", ofType: "plist"){
    YuuManager.shared.config(plistPath: plistPath)
    } else {
    YuuManager.shared.config()
    }
    return true
    }
    //objc
    //Add sdk config method to your `AppDelegate.m`
    #import "YuuSDK/YuuSDK-Swift.h";
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"YuuSDK-Info" ofType:@"plist"];
    [YuuManager.shared configWithPlistPath: plistPath];
    return YES
    }
  1. To receive and handle deep link callbacks from the yuu App, implement the following method in your AppDelegate:

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    YuuManager.shared.handleCallback(url: url)
    return true
    }
  2. Allow URL Scheme Querying, add the following to your Info.plist to allow your APP to open the yuu App:

    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>yuu-sit</string>
    <string>yuu</string>
    </array>