[iOS] How to invoke other Apps H5 interface call Open app

Source: Internet
Author: User

Reference: App wake-up app

H5 Wake-up app

Interesting URL Scheme

The work to be done by the evoked side (DEMOAPP):

1. Set URL scheme is just an app's logo specifically what to set a scheme corresponding to an app corresponding to the identifier is the project's build ID

2. Check if there is a corresponding value in the Info.plist file

The wake-up job is done.

In this method of Appdelegate controller, we can get the specific request information so that we can choose whether to wake the app.

-(BOOL) Application: (UIApplication *) application OpenURL: (Nsurl *) URL sourceapplication: (NSString*) sourceapplication Annotation: (ID) annotation{NSLog (@"calling Application Bundle ID:%@", sourceapplication); NSLog (@"URL scheme:%@", [URL scheme]); NSLog (@"URL query:%@", [url query]); //Customer Code    returnYES;}

Wake-up work: (test)

1. Open the corresponding scheme:

One thing to keep in mind this URL needs to be added at the end of scheme://For example, set scheme is a then the URL to open is a://

- (void) awakeotherapp{NSString*customurl =@"opendemoapp://"; if([[[UIApplication sharedapplication] Canopenurl:[nsurl Urlwithstring:customurl]] {[uiapplication    Sharedapplication] Openurl:[nsurl Urlwithstring:customurl]; }    Else{Uialertview*alert = [[Uialertview alloc] Initwithtitle:@"URL Error"message:[nsstring stringWithFormat: @"No custom URL defined for%@", CustomURL]Delegate: Self Cancelbuttontitle:@"Ok"Otherbuttontitles:nil];     [Alert show]; } }

Call this method at the corresponding location to

After iOS9, because of the security concerns, you need to set a white list in the Info.plist file, if not set, the following error message will be wrapped:

 for " opendemoapp:// " " This app isn't allowed to query for scheme Opendemoapp "

White list settings are as follows:

In the Info.plist file, add:

The value is the scheme that was previously set this is not://

H5 invoke the app's method can refer to the above link

Demo (Extract code: YSFU)

[iOS] How to invoke other Apps H5 interface call Open app

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.