IOS - So implementieren Sie Deep Links, um App zu öffnen oder mit dem URL -Schema zum iTunes -Link zu gehen
Posted: 21 Mar 2025, 09:01
Ich habe ein Problem mit dem URL -Schema in der Plist -Datei als "m.zameen.com"
, aber ich tippe dies in den Safari -Browser des iPhone, nicht op [EN [EN), aber wenn ich mit: // geöffnet bin, öffnete es < /p>
, aber ich tippe dies in den Safari -Browser des iPhone, nicht op [EN [EN), aber wenn ich mit: // geöffnet bin, öffnete es < /p>
Code: Select all
// In AppDelegate.m file
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
if([[url host] isEqualToString:@"page"]){
if([[url path] isEqualToString:@"/main"]){
[self.mainController setViewControllers:@[[[DLViewController alloc] init]] animated:YES];
}
else if([[url path] isEqualToString:@"/page1"]){
[self.mainController pushViewController:[[Page1ViewController alloc] init] animated:YES];
}
return YES;
}
else{
return NO;
}
}
// In DLViewController.m file
- (IBAction)page1Clicked:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"m.zameen.com://page/page1"]];
}
// In Page1ViewController.m file
- (IBAction)mainPageClicked:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"m.zameen.com://page/main"]];
}