Check if custom URL scheme is defined

Source: Internet
Author: User
Check if custom URL scheme is definedposted on July 15,201 2 by John muchow in core services

Custom URL schemes are the apple approved way for one application to communicate with another. For example, you can launch the phone application to make a call using the custom URLTel ://. Likewise, you can call a third party (non Apple) application using a custom URL, and similarly, other applications call invoke your app if you define a custom URL.

If you plan to call another application via a custom URL scheme on iOS, here a quick tip to check if a specific URL scheme is defined. the two examples below show the code for creating an nsurl object with the destination URL scheme and using the shared application instance to verify if the URL can be opened:

  // If Facebook application installed   If   (  [  [ uiapplication sharedapplication ]  canopenurl :   [  nsurl  urlwithstring :  @  "FB: // " ]  )  {  DO  something... }  // If eBay application installed   If   (  [  [ uiapplication sharedapplication ]  canopenurl :   [  nsurl  urlwithstring :  @  "eBay: // " ]  )  {  DO  something... } 

There are no restrictions on who can define what m URL. for example, FB: // is not necessarily limited to Facebook, so this process is not entirely foolproof. from what I 've read, Apple does not define the process for determining which application will be called if more than one app has registered the same URL.

Here are a few posts on getting started with custom URL schemes:

-Launching an application via a custom URL Scheme

-Launching other apps within an iPhone application

-Launching other apps within an iPhone application (Part 2)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.