Jump between Apps for iOS (no third party participation)

Source: Internet
Author: User

One: URL: Uniform Resource Locator (can have no path, but must have protocol header)

Typically, the application does not have a URL by default. and open an app in iOS as soon as you get the app's protocol header.

An application can set a URL (protocol header) in the Info->url type to configure the protocol header.

Open the other application method code as follows:

Specific steps:

1. Get the URL of the corresponding program

2. Determine if a corresponding application is installed in the program by Canopenurl

3. If you open the application

The code is as follows:

Second: How to open/jump in the app to determine which page of the app is open (such as a friend circle or a friends list)

Steps:

1. Through the OpenURL method in application, convert the URL into a string

2. Get the home controller, get the root controller through the navigation controller, and jump from the root controller at each turn

3. Decide which path to jump through (by judging if there is a corresponding path in the string, if so, open the page of the Jump app)

The code is as follows:

Note: When the application is in the kill state, it is also possible to jump, open the program by didfinishlaunching and then jump to perform the above method

Third, how to jump to the application after the end of the original application

Steps:

1. Add a Back button to the Jump app

2. Set the URL of the original application, as above, set a URL (protocol header) in the Info->url type, and configure the protocol header

Note: When we go back to the original application via an app, the URL can not be written dead, we need to put the original URL of the application to jump to the application, through our own set a specification, the original application URL stitching to the application path we need to jump behind. When we want to jump back, through the original application URL to jump back, this will be more flexible.

Tip: There are two ways to apply the URL of the app jump to the original app

Method 1> by setting a URL string property in Appdelegate, in the method of opening the application, the URL passed in to the URL of appdelegate, and then in the corresponding interface through a singleton attribute to get the URL string intercept the URL of the original application, To return, relatively simple;

Method 2> through the way of event delivery, by setting a urL string property in the host controller, in the method of opening the application, the URL that is passed in to the homepage controller is assigned to the URL of the master, and the URL is passed to the jump interface in the home controller. Then in the corresponding interface through a singleton attribute to get URL string intercept the URL of the original application, to return, the method code is as follows:

Home Controller property values are passed to the destination controller properties:

The final implementation method is as follows:

Of course, the original jump time parameters need to change, with the original application URL, as follows:

Jump between Apps for iOS (no third party participation)

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.