Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web service for deep linking

This is my first time create an ios application that required deep linking. I need to create a web service for my custom url scheme for ios in order to publish it online. Please give some pointer on regarding which web service i should use or is there an alternative way to create a deep linking for custom url scheme for iOS. Thanks.

like image 240
Hoon Avatar asked Mar 23 '23 03:03

Hoon


1 Answers

You can do it yourself with any server platform - Rails, PHP, Dot.Net, etc.

Here is a very simple PHP snippet. Replace "myappname" with your app's URL scheme. The param/value query is optional - you can use any other text and parse it in your App Delegate's openUrl method.

if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS') !== FALSE) {
  // redirect
  header("location: myappname://?key=value");
  exit();
}

Client use-cases:

  • iOS Safari, your app installed - will open your app.
  • iOS Safari, your app not installed - Safari will complain that it cannot open the link.
  • Another iOS app, your app installed - will switch to your app.
  • Another iOS app, your app not installed - same as Safari. However, if the other app is implementing UIApplication's canOpenURL: - it may gracefully take the user to the App Store, but it's up to the other app developer.
  • Any other device or browser - will continue to render the page, where you can add your html including AppStore links.
like image 126
Tal Yaniv Avatar answered Apr 02 '23 20:04

Tal Yaniv