Navigation and communication between two apps in iOS and iosapp

Source: Internet
Author: User

Navigation and communication between two apps in iOS and iosapp

Jump between apps

1. perform the following operations on the first app;

1. Add a URL types under the Information Property List in the info. plist file.

2. Open item 0 under URL types, click item 0, and change the URL identifier under item 0 to URL Schemes.

3. Click item 0 under URL Schemes and add skipOne to the end of it (skipOne is the jump ID of the first app, which is written by you here)

2. In the second app, add the following code to the place where you want to jump to the first app:

NSString *aString = @"skipOne://";    NSURL * url = [NSURL URLWithString:aString];    [[UIApplication sharedApplication]openURL:url];

3. re-run the second app and trigger the event to jump to the first app. This completes the redirection between simple apps.

 

Value Transfer Between apps

I. First, implement the jump function between apps.

II. The above code needs to be slightly modified.

NSString * aString = @ "skipOne ://"
In the above Code, add some information after (skipOne: //)For example:
NSString *aString =[NSString stringWithFormat:@"skipOne://username=%@&age=%@", @"xiaoxiao", @"30"];
3. In the APPDelegate of the first APP
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{    NSString *urlStr = [url absoluteString];    NSLog(@"%@",urlStr);    return YES;}

In this way, the urlStr string is obtained, and the string needs to be processed according to the required data.



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.