1, new two projects: Appone,apptwo;
2, respectively in their list of attributes are added as follows:
Appone:
Apptwo:
Add code to the Appone viewcontroller.m:
-(void) Touchesbegan: (Nsset *) touches withevent: (Uievent *) event
{
Nsurl *url = [nsurlurlwithstring:@ "Apptwo:"];
if ([[[Uiapplicationsharedapplication] canopenurl:url])//Determine if the device is installed Apptwo
{
NSLog (@ "Canopenurl");
[[UIApplication sharedapplication] openurl:url]; Open the Apptwo application if you want to carry the parameters: nsurl *url = [nsurlurlwithstring:@ "apptwo://you want to carry algebra"];
} else
{
NSLog (@ "Can not OpenURL");
}
}
Add code to the Apptwo viewcontroller.m:
Appdelegate inside Receive URL
-(BOOL) Application: (UIApplication *) app OpenURL: (nsurl *) URL options: (nsdictionary< Uiapplicationopenurloptionskey, id> *) options
{
NSLog (@ "--%@", url);
return YES;
}
-(void) Touchesbegan: (Nsset *) touches withevent: (Uievent *) event
{
NSLog (@ "Touchesbegan");
Nsurl *url = [nsurlurlwithstring:@ "Appone:"];
if ([[Uiapplicationsharedapplication] canopenurl:url])
{
NSLog (@ "Canopenurl");
[[UIApplication sharedapplication] openurl:url];
} else
{
NSLog (@ "Can not OpenURL");
}
}