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