Search code examples
iosswiftqr-codedeep-linkingcustom-url

Opening iOS App from Custom URL in QRCode


I want to open my app from a URL from QRScan , which is common when your custom URL looks like this "myappname://productid". my problem is that I want my app to open from a Website type URL which is something like this "https://myappname.com/productid"

How can i achieve this ?


Solution

  • This can be achieve by using universal links. For simplicity and high level implementation I will recommend you to use Firebase's dynamic link product. It is very well documented and more over its free to use.

    Before you began I think you might need apple developer account.

    Steps

    1. Create a project and an app on the firebase console.

    2. From the left menu under the Grow section select dynamic links.

    3. Create a domain as per your preferences e.g. https://yourapp.page.link

    4. Now goto apple developer portal and edit your app id and enable associated domains for it.

    5. Now open and select your xcode project under the project navigator section on the left side.

    6. Then goto signing and capabilities section and click on add capability

    7. Add the associated domains in you capabilities.

    8. Then Add your created domain in it like this: applinks:yourapp.page.link

    9. Make sure to add your team id and app id in the firebase console.

    10. Now depending on your requirement you can create fixed dynamic link through firebase console or alternatively you can use their api to create links. in case your link is user specific or you want to add unique info in each link.

    11. Now when someone click on the link depending on the platform the link behave accordingly as per the parameters provided during the link creation process.

    These are just high level steps for detailed implementation and available options you can always refer to the dynamic link documentation