Use this walkthrough to integrate the LinkMe iOS SDK into a SwiftUI or UIKit app.
Before you start
- A LinkMe account with an app configured
- Your iOS bundle ID and Apple Team ID
- Xcode 15 or newer
- iOS deployment target set to iOS 14 or newer
- API keys from App Settings → API Keys
1. Install LinkMeKit
Swift Package Manager (recommended)
- In Xcode, choose File → Add Packages….
- Enter
https://github.com/r-dev-limited/li-nk.me-ios-sdk. - Select
v0.2.16or a later release and add theLinkMeKitproduct to your app target.
The package manifest is at the repository root, so the repository URL can be used directly.
CocoaPods
For the v0.2.16 source release, use the public Git tag directly:
pod 'LinkMeKit', :git => 'https://github.com/r-dev-limited/li-nk.me-ios-sdk.git', :tag => 'v0.2.16'
The 0.2.16 CocoaPods registry spec is pending publication. Use SwiftPM or the Git tag above to receive the current fixes.
2. Configure the SDK
Initialize LinkMe during app launch. Use your branded deep-link host as baseUrl, or use
https://li-nk.me while testing.
import SwiftUI
import LinkMeKit
@main
struct DemoApp: App {
init() {
LinkMe.shared.configure(config: .init(
baseUrl: URL(string: "https://links.yourco.com")!,
appId: "your_app_id",
appKey: "your_app_key",
sendDeviceInfo: true,
includeVendorId: true,
includeAdvertisingId: false,
debug: true
))
}
var body: some Scene {
WindowGroup { ContentView() }
}
}
3. Configure Universal Links
- In Xcode, open Signing & Capabilities for your app target.
- Add the Associated Domains capability.
- Add:
applinks:links.yourco.com
LinkMe hosts the AASA file after the domain is connected in the portal. If you also use a custom
URL scheme, add it under CFBundleURLSchemes in Info.plist.
4. Handle direct and deferred links
struct ContentView: View {
@State private var message = "Waiting for link…"
@State private var unsubscribe: (() -> Void)?
private func display(_ payload: LinkPayload?) {
guard let payload else { return }
DispatchQueue.main.async { message = "Opened: \(payload.path ?? "/")" }
}
var body: some View {
Text(message)
.onOpenURL { LinkMe.shared.handle(url: $0) }
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) {
LinkMe.shared.handle(userActivity: $0)
}
.onAppear {
unsubscribe?()
unsubscribe = LinkMe.shared.addListener { display($0) }
LinkMe.shared.getInitialLink { initial in
if initial != nil { display(initial) }
else { LinkMe.shared.claimDeferredIfAvailable { display($0) } }
}
}
.onDisappear { unsubscribe?(); unsubscribe = nil }
}
}
Use LinkMe.shared.addListener for links received while the app is running:
let unsubscribe = LinkMe.shared.addListener { payload in
routeUser(to: payload)
}
// When the owner is removed:
unsubscribe()
Call setAdvertisingConsent(true) only after your own consent and ATT flow. Pasteboard behavior
is controlled from App Settings → iOS in the LinkMe portal.
5. Test the integration
The SDK repository includes a runnable ExampleApp. Update its configuration with your keys,
run it on a simulator or device, and test both a direct Universal Link and a first-install
deferred link.
Troubleshooting
- If a link opens Safari, verify the bundle ID, Team ID, Associated Domains entitlement, and AASA response.
- If the SDK returns no payload, confirm
baseUrl,appId,appKey, and that the app callsconfigurebefore handling links. - If deferred attribution is missing, enable the portal’s Pasteboard setting or allow the fingerprint fallback endpoint.
See the iOS SDK reference for the complete API surface.
Call LinkMe.shared.setUserId(nil) on logout. SDK callbacks may arrive off the main thread; dispatch UI updates to the main queue, as above.