IOS
1. Framework import
Copies the OmniLinkframewrok in the target App directory.

Next, import the library to Embed & Sign that is in Project setting - General - Frameworks, Libraries, and Embedded Content.

2. Universal Link Settings
Run an App with the Universal Link method in an iOS 9 or above environment. For details regarding the Universal Link please check the developer site (https://developer.apple.com/ios/universal-links/).
2.1 apple-app-site-association
Requires a Trusted SSL applied domain in order to support the Universal Link. And position it on "URL root/apple-app-site-association" or "URL root/.well-known/apple-app-site-association" by creating a file that has no accessible "apple-app-site-association" extension in that domain. (Ex: https://cloud.raonmobilesecurity.com/.well-known/apple-app-site-association)
Enter the file with the text editor below.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "Z4BS3F3UYR.com.raonsecure.rsbridge.sample.ios",
"paths": [
"/resources/rswta/appfree.jsp"
]
}
]
}
}
"paths" from the above contents is an address which corresponds to universalLink defined on Javascript RSBridge.conf.js. Moreover, "appID" is composited with "#Prefix.#BundleID#" and please check below for more details.
2.2 Apple Developer
Activate "Associated Domains" as shown below in the target App on a App IDs(https://developer.apple.com/account/ios/identifier/bundle) of the Developer site.
Prefix and BundleID can be checked

2.3 Project setting
Activate the Associated Domains function in the Capabilities in project settings in the Xcode. Click the below + button to enter URL to apply to the Universal Link (ex: applinks:#DomainName#)

When processing without any error, it will automatically create the entitlements file as below.

3. Callback Browser Scheme setting
In order to go back from the Receive App to the Send App or browser, it is required to input in advance in a custom scheme which is supported by the Send App and browser. Add LSApplicationQueriesSchemes as below in the Xcode - Project setting - Info - Custom iOS Target Properties or info.plist

info.plist can also add through the editor.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>customsendscheme </string>
<string>googlechrome</string>
<string>googlechromes</string>
<string>firefox</string>
<string>naversearchapp</string>
<string>daumapps</string>
<string>nate</string>
<string>opera</string>
<string>touch-url</string>
<string>kakaotalk</string>
<string>access</string>
</array>
4. Custom Scheme setting
Set Custom Scheme for the environment that does not support the Universal Link. Enter the scheme name as below in the Xcode - Project setting - Info - URL Types or info.plist.

5. API
5.1 setFallbackURL
CLASS
Content
Purpose
Directs to the market when the target App is not stored in the device
Use
ToAppManager.sharedInstance.setFallbackURL(url: "App Store URL")
Parameter
url Required
Return
void
Example
ToAppManager.sharedInstance.setFallbackURL(url: "App Store URL")
Note
Uses the transmitting App
5.2 callApp
CLASS
Content
Purpose
Use it when calling and forwarding data from the transmitting App to the target App
Use
ToAppManager.sharedInstance.callApp
(scheme: "sendappScheme", host: "sendappHost", type: "type", select: "select"
, responseHost: "myHost", responseScheme: "myScheme")
Parameter
host Required, scheme Required, type Optional, select Optional
, responseHost Required, responseScheme Required
Return
void
Example
ToAppManager.sharedInstance.callApp
(scheme: "receivescheme", host: "receivehost", type: "didauth", select: ""
, responseHost: "sendhost", responseScheme: "sendscheme")
Note
Uses the transmitting App
5.3 receive
CLASS
Content
Purpose
A function that runs on the Appdelegate when the target App runs
Forwarded data setting on the transmitting App
Use
ToAppManager.sharedInstance.receive(url: URL)
Parameter
url Required
Return
NSMutableDictionary
Example
let receiveData = try? ToAppManager.sharedInstance.receive(url: url)
Note
Uses the target App
5.4 returnResult
CLASS
Content
Purpuse
Uses when calling and forwarding data from the target App to transmitting App
Use
try? ToAppManager.sharedInstance.returnResult(result: "base64 encoded string")
Parameter
result Required
Return
void
Example
let resultText = "callback results for test AppToApp" let encoded = resultText.toBase64()
try? ToAppManager.sharedInstance.returnResult(result: encoded)
Note
Uses the target App
5.5 resultReceive
CLASS
Content
Purpose
Extracts received data from the target App
Use
try? ToAppManager.sharedInstance.resultReceive(resultEnc: "call back data encoded base 64")
Parameter
resultEnc Required
Return
String
Example
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
let items = urlComponents?.queryItems
if let result = items?.filter({$0.name == "result"}).first?.value {
vc.callbackString = try? ToAppManager.sharedInstance.resultReceive(resultEnc: result)
}
Note
Uses the transmitting App
6. Sample Source
6.1 Transmitting App
6.1.1 ViewController.swift
import UIKit
import OmniLink
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
ToAppManager.sharedInstance.setFallbackURL(url: "App Store URL")
}
@IBAction func callSchemeBtnAction(_ sender: UIButton) {
ToAppManager.sharedInstance.callApp(scheme: "receivescheme", host: "receivehost", type: "customType", select: "customSelect", responseHost: "sendhost", responseScheme: "sendscheme")
}
}
6.1.2 AppDelegate.swift
import UIKit
import OmniLink
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
let items = urlComponents?.queryItems
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
if let result = items?.filter({$0.name == "result"}).first?.value {
vc.callbackString = try? ToAppManager.sharedInstance.resultReceive(resultEnc: result)
//… do something with callbackString
}
if let window = self.window {
let navi = UINavigationController.init(rootViewController: vc)
window.rootViewController = navi
}
return true
}
}
6.2 Target App
6.2.1 ViewController.swift
import UIKit
import OmniLink
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func callbackBtnAction(_ sender: UIButton) {
let resultText = "callback results for test AppToApp"
let encoded = resultText.toBase64()
// result must be base64 encoded string
try? ToAppManager.sharedInstance.returnResult(result: encoded)
}
}
6.2.2 AppDelegate.swift
import UIKit
import OmniLink
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
let items = urlComponents?.queryItems
let receivedDict = try? ToAppManager.sharedInstance.receive(url: url)
//… do something with receivedDict
return true
}
}
Last updated
Was this helpful?