Jump between IOS app and app and app with Safari

Source: Internet
Author: User

Recent projects have encountered a need to jump from app to Safari and then back to app. It's easy to jump from app to Safari before, but here's not much to say. focus on jumping back to the app from Safari and jumping from app to app. (actually these two are almost one thing.) )

First jump from Safari to app

Now that you want to jump to the app you specify, you need to define a special label in your app, which is a URL protocol.

Define a URL protocol such as targets--> info-->url types--> Add a URL protocol


Where the URL schemes field is the special label for your app, and the indentifier field is the URL agreement. (an app can have multiple URL protocols)

The following two fields can be empty. Finally, run your app again.

And then it's time to witness the miracle.

Open the Safari browser in your simulator, enter in the Address field in the input:appabc://

Then enter, and the result is what you want. (Isn't it simple?) )

Sometimes you may need to jump back from Safari to the app simultaneous some parameters, so what's the way to receive these parameters?

Write the following method in the APPDELEGATE.M file:


This method is automatically called by the system, meaning: If the app is opened by OpenURL, this method is called automatically. The parameter URL is the specific URL that opens the app. that is the appabc:// above , but how to pass this method to the argument?

The answer is in the URL, and you can add any character arguments you want after appabc:// , such as Appabc://name:wanglei//name:lilei

As for how to parse these parameters, it depends on how you deal with them.

Here is the app (A) Jump App (B)

Before saying that the principle between them is the same, jumping from safari to app is by opening a specific URL, then from the app (A) Jump App (B) do you want to open a specific URL?

The answer is yes, then how to open this particular URL, in fact, in uiapplication there is such a method OpenURL, as follows

[[UIApplication shareapplication] Openurl:url]

The URL for the parameter URL is the URLs represented by the app (B) specific URL protocol (demo is attached later)

As for the processing of parameters, ibid.

Here is the demo with app (A) and app (B) jumping to each other

http://download.csdn.net/detail/u012884714/7679105


This article is here, welcome to communicate--LC




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.