iOS - Installation & Integration
Requirements
iOS 15.0+
Installation
-
Add the private repository:
#open terminalpod repo add YuuSDK https://bitbucket.org/dfi-pdd/yuu-ios-sdk-podspecs.git -
Edit
Podfile:#Edit Podfile#Add these codes to the top of the Podfileplatform :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>' dopod 'YuuSDK'end -
Pod install
#open terminalpod install --repo-update
Integration
Init SDK
Add the Configuration plist.
-
Add
YuuSDK-Info.plistto 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> -
You can add your plist path with the above plist format.
//swift//Add sdk config method to your `AppDelegate.swift`import YuuSDKfunc 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}
Handle Deep Link Callback (Custom URL Scheme)
-
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} -
Allow URL Scheme Querying, add the following to your
Info.plistto allow your APP to open the yuu App:<key>LSApplicationQueriesSchemes</key><array><string>yuu-sit</string><string>yuu</string></array>