Mutual jump between apps and mutual jump between apps

Source: Internet
Author: User

Mutual jump between apps and mutual jump between apps

The first time I wrote a blog, I believe many people have used umeng sdks or other third-party sharing tools to jump between different apps in iOS development. The principles are the same.

The jump is implemented in four steps:

Step 1: create two projects to simulate the environment of the two apps

Step 2: Set the url of Application 2 in the second project

Step 3: Write A UIButton in the first project, and the button method is as follows:

Note that appID is added ":"

Step 4: run two projects, generate the app, and open the first project. click the button to jump to the second project.

 

When opening the second page, we should have the following two points of attention:

 

First:

1. If the second app is not started, the second app will be started and the method in the second project will be called:

-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {

// Override point for customization after application launch.

Return YES;

}

2. If the second program is started and runs in the background, this method will not be called.

 

 

 

Second, we can use a method to pass parameters:

// This method is called when an application is opened by another program. In this method, data transfer between two applications can be implemented.

-(BOOL) application :( UIApplication *) application openURL :( NSURL *) url sourceApplication :( NSString *) sourceApplication annotation :( id) annotation

{

NSLog (@ "% @", url );

NSLog (@ "% @", sourceApplication );

Return YES;

}

 

Related Article

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.