Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

If you don't want to create the server code, you can use a tool I created for this purpose. You have it here: http://www.uppurl.com/

It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.

Take care of Tal answer as latest versions of Chrome has changed the way to open app and now you need to provide a link in different format, they use something like "intent://..."

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top