Ryan Watson
Ryan Watson

Reputation: 108

How to open iOS app when user scans a QR Code with an URL in it

I want to create a QR Code that contains a URL like https://example.com in it and when an user scans that, if they have the app installed on the phone, to open the app instead of going to the browser. Is that possible? I've looked at App Links and Universal Links and I can't see to get it to trigger off of a QR Code or with HTTPS instead of some custom URL.

Upvotes: 2

Views: 5763

Answers (1)

Alexander Vasenin
Alexander Vasenin

Reputation: 13033

Scanning QR code containing a URL with standard Camera app results in prompt to open the link in Safari. If the link in question is Universal Link and you do have the associated app installed, the prompt shows your app instead of Safari. If a user taps on that prompt your app is brought to foreground and application(_:userActivity:restorationHandler:) is called. It seems like it's not documented anywhere, but most likely it's an intended behavior and it's definitely working.

Upvotes: 10

Related Questions