gpt4 book ai didi

ios - 如何在 Safari iOS 中启用从深层链接启动应用程序

转载 作者:行者123 更新时间:2023-11-29 01:12:25 25 4
gpt4 key购买 nike

我的老板让我在 Objective-C 应用中启用深度链接,但我不懂那种语言。首先,我在 info.plist 中启用了 URL 方案:

enter image description here

然后在我的 AppDelegate.m 中我有:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[NSThread sleepForTimeInterval:2]; //add 2 seconds longer.

// Do your time consuming setup

[splashView removeFromSuperview];

_pushDict= nil;
[self APNSRegistration];
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];

//[UIApplication sharedApplication].applicationIconBadgeNumber =0;
// Assign tab bar item with titles
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3];
UITabBarItem *tabBarItem5 = [tabBar.items objectAtIndex:4];

tabBarItem1.title = @"";
tabBarItem2.title = @"";
tabBarItem3.title = @"";
tabBarItem4.title = @"";
tabBarItem5.title = @"";
NSString *badgeValue = [NSString stringWithFormat:@"%ld", (long)[UIApplication sharedApplication].applicationIconBadgeNumber];
if([badgeValue isEqual: @"0"]) badgeValue = nil;
tabBarItem3.badgeValue = badgeValue;

//unselected
[tabBarItem1 setImage:[[UIImage imageNamed:@"0003-home3.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem1 setSelectedImage:[[UIImage imageNamed:@"0003-home3_selected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//unselected
[tabBarItem2 setImage:[[UIImage imageNamed:@"tazza.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem2 setSelectedImage:[[UIImage imageNamed:@"0163-mug_selected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//unselected
[tabBarItem3 setImage:[[UIImage imageNamed:@"0084-calendar.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem3 setSelectedImage:[[UIImage imageNamed:@"0084-calendar_selected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//unselected
[tabBarItem4 setImage:[[UIImage imageNamed:@"0016-camera.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem4 setSelectedImage:[[UIImage imageNamed:@"0016-camera_selected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//unselected
[tabBarItem5 setImage:[[UIImage imageNamed:@"0072-location.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem5 setSelectedImage:[[UIImage imageNamed:@"0072-location_selected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

NSDictionary *pushDict = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

_pushDict= pushDict;
return YES;
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
printf("openURL called");
return YES;
}

如果我从 iOS Safari 启动 URL superbar:// 它说 Safari 无法打开页面。我确定我在 didFinishLaunchingWithOptions 中遗漏了一些东西,但是什么?

最佳答案

只需在 Safari 地址栏中输入 superbar://。应用程序应该启动。请检查您的信息选项卡 -> URL 类型

关于ios - 如何在 Safari iOS 中启用从深层链接启动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35583784/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com