Open the specified app via the link address in iOS and pass the reference by Xuwenchang chess

Source: Internet
Author: User

Based on the needs of the project, sometimes it is necessary to directly open the client that we have developed through a link or QR code scan.

Of course. The client is not just needed to be opened, but also to jump to the corresponding page, so it is necessary to pass the parameter.

The client wants to use the link to open, must add the corresponding URL types in Info.plist:(if there is no corresponding line please add it yourself!)

After setting up this URL, we're going to respond to an event where the app is opened (linked with a URL)

So.. Go to appdelegate.m .

Implementing an Agent Approach

-(BOOL) Application: (UIApplication *) application Handleopenurl: (Nsurl *) url{       return YES;    

Then we can get to the URL that opens the app with the URL from the above callback.

If you open the app with Urldemo://hehehe, the callback URL is urldemo://hehehe.

As for the argument, since this is not like HTTP can get the post or get parameters, so we have to manually parse it.

Here urldemo://hehehe We can take hehehe as the parameter body, and then do what we do ...

Ps:ios, Safari can also open this app by opening this URL.

PS2: Other applications use this method to open the application

[[uiapplication sharedapplication]openURL: [nsurl urlwithstring:@ " Urldemo://hehehe "];

PS3: No.

Open the specified app via the link address in iOS and pass the reference by Xuwenchang chess

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.