iOS in five steps
The shortest path to a working iOS integration. Every step is the minimum that works, with no options. For anything beyond that, each step links to the iOS SDK reference, which is where the detail lives.
1. Install
Section titled “1. Install”In Xcode, File > Add Package Dependencies, enter
https://github.com/tolinku/ios-sdk, and add the TolinkuSDK library to your
target.
Swift Package Manager resolves the version you pick in Xcode. Pick the latest.
2. Set up Universal Links
Section titled “2. Set up Universal Links”You need the Associated Domains entitlement on your target and an AASA file served from your domain. Both are in Universal Links (iOS).
If links still open Safari after this, go to Troubleshooting iOS rather than changing the code below.
3. Configure
Section titled “3. Configure”As early in the app lifecycle as you can reach:
import TolinkuSDK
do { try Tolinku.configure(apiKey: "tolk_pub_your_key")} catch { print("Tolinku configuration failed: \(error)")}Get the key from the dashboard under API keys. The publishable key
(tolk_pub_) is the right one for an app.
4. Claim the deferred link on first launch
Section titled “4. Claim the deferred link on first launch”This is what recovers the link somebody tapped before they had your app.
if let link = try await Tolinku.shared?.deferred.claimDeferredLink( appspaceId: "64f0a1b2c3d4e5f60718") { // Route to link.deepLinkPath, then step 5.}Call it once, on the first launch after install. The claim is spent the first time it succeeds.
appspaceId is the Appspace ID from Settings, not your subdomain. Passing
the subdomain makes every call return nil. See
finding your Appspace ID.
5. Report the open
Section titled “5. Report the open”Two calls, and they are not the same event.
An ordinary open, wherever your app receives a link:
func application(_ app: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { if let url = userActivity.webpageURL { Task { await Tolinku.shared?.trackLinkOpen(url.absoluteString) } } return true}The open that follows the claim in step 4, which is the last step of the install funnel:
if let url = link.url { await Tolinku.shared?.trackLinkOpen(url, deferred: true)}Report link.url, never the path. A path is dropped before it leaves the SDK,
silently. This needs SDK 0.8.1 or later.
Whether these are counted, and what they cost, is an Appspace setting: Attributing app opens.
That is a working integration. For referrals, in-app messages, ecommerce events, custom events and every option on the calls above, go to the iOS SDK reference.