Integration of applications within the system

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



I want to tell beginners how it works, and professionals why it should be done.

Welcome to cat.


How it works

An application that uses someone else's scheme may use similar code:
NSURL *url = [NSURL urlWithString:@"myScheme://..."];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
   [[UIApplication sharedApplication] openURL:url];
} else {
   //Приложение с нужной схемой не установлено
}


An application that executes a circuit:
  1. In ..- info.plist you need to add your scheme:
  2. And add startup processing through the circuit 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:
  • http for Safari, which is logical, because this is the default browser
  • tel in order to call the user with the specified number
  • mailto to send emails from standard mail (what if sparrow could do that)
  • sms to send sms


Why is it necessary

Some time ago, I was developing a very narrow-minded program for iPhone / iPad, which 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 looking, but unfortunately did not find their URL schemes. The other day, while reading a hub, I saw a post where a person wrote about the principle of testflight, he referred to handleopenurl.com , where each developer can add his application and his url scheme. Although, there are still about 400 applications, but imagine what can give the development of this or a similar service on a very large scale.

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

I believe that the future lies with the integration between applications. In this case, sales of one may stimulate sales of the other. For example, to add the ability to connect from my application via SSH to the server, you only need 20-30 minutes of time (I still found 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 a user can get additional functionality in another application, but it will be integrated with the one that he is currently using.

If a person really needs it, 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 do not be lazy, but do their own URL schemes in their applications and publish them on handleopenurl.com (although the service is not perfect, I did not find another). Fortunately, this takes only a few hours.