📜 ⬆️ ⬇️

Integration of applications within the system

I think that for most habra people it is not a secret that each application can have its url scheme, which will allow other applications to interact with yours.



I want to tell beginners how it works, and to professionals - why it should be done.
')
Welcome under cat.


How it works

An application that uses someone else's scheme can use similar code:
NSURL *url = [NSURL urlWithString:@"myScheme://..."]; if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url]; } else { //      } 


An application that executes the circuit:
  1. In ..- info.plist you need to add your scheme:
  2. And add start processing through the schema in this method:
      - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { //    } 


By the way, maybe not everyone knows that Apple has its own custom schemes for several applications:


Why do you need it

Some time ago I was developing a very narrowly focused iPhone / iPad program that allows you to manage VPS hosting. And I thought, what if I had the opportunity to give the user one click to go to iSSH or Coda, so that he could connect to the server via SSH with a minimum of his own movements.

I went to search, but, unfortunately, did not find their URL schemes. The other day, while reading Habr, I saw a post where a person wrote about the principle of testflight operation, he referred to the site handleopenurl.com , where each developer can add his application and his url scheme. Although, there are still about 400 applications there, but imagine what can be provided by the development of this or a similar service on a very large scale.

For example, to tweetbot gave you a choice, open a link in Safari or Chrome, and maybe in iCab?

I believe that the future lies precisely with the integration between applications. In this case, the sale of one can stimulate the sale of another. For example, to add an opportunity from my application to connect via SSH to the server, you only need 20-30 minutes of time (I did find the iSSH scheme), but the iSSH application costs money. Now imagine that the developers will start placing banners in their applications, where it will be written that for only n dollars the user can get additional functionality in another application, but it will be integrated with the one he is currently using.

If a person really needs this, then he will go and buy this application. For example, in my case, iSSH.

In this regard, I suggest that all developers who read this should not be lazy, but make their own URL schemes in their applications and publish them on handleopenurl.com (although the service is not perfect, but I haven’t found another). Fortunately, it takes only a few hours.

Source: https://habr.com/ru/post/150408/


All Articles