Skip to main content

Testing and Troubleshooting

Testing deferred links on iOS has platform constraints (App Store redirect chain, first-launch-only semantics).

Deferred flow constraints

  • Deferred matching is expected on first launch after install.
  • SDK stores first-entrance flag in UserDefaults; later launches return empty result for deferred fallback.
  • Session handling is single-pass; repeated startup resolution in one session is skipped.
  1. Uninstall app from device/simulator.
  2. Open a Detour link.
  3. Install app and launch.
  4. Verify result.link?.type == .deferred and expected route mapping.
  5. Reopen app and confirm deferred link is not consumed again.

For local iteration without reinstall every time:

Detour.shared.resetSession(allowDeferredRetry: true)

Simulator custom scheme

xcrun simctl openurl booted "myapp://products/42"

Expected: runtime processLink resolves to .scheme.

xcrun simctl openurl booted "https://<your-detour-domain>/products/42"

Expected: runtime processLink resolves to .verified when associated domains are configured.

Troubleshooting checklist

  • No link handled on cold start
    • ensure resolveInitialLink(config:launchOptions:) (or connectionOptions overload) is called once at startup.
  • Universal links open Safari instead of app
    • verify associated domains entitlement and Dashboard domain configuration.
  • Scheme links do nothing
    • verify CFBundleURLTypes in Info.plist.
  • Expected scheme link is ignored
    • check linkProcessingMode; .webOnly and .deferredOnly intentionally skip non-web URL-like links.
  • Analytics events missing in Dashboard
    • ensure analytics is mounted (resolveInitialLink mounts automatically; manual flow can call mountAnalytics).

Debugging

SDK logs through Apple unified logging under subsystem com.swmansion.detour.

On simulator/device:

xcrun simctl spawn booted log stream --predicate 'subsystem == "com.swmansion.detour"'

For end-to-end setup template, use Examples.