首页 > 解决方案 > 如何在网站上制作“在应用程序中打开”IOS栏?

问题描述

我需要添加相同的栏(最上面的,对不起RU lang,栏使用OS语言,反正Открыть等于Open)FB示例,据我了解,它是原生的,所以我找到了一种添加if的方法, 添加到

 <meta name="apple-itunes-app" content="app-id=MyAppId(it exists on app store)">

下载应用程序并在本地部署站点后,我从 iPhone 打开它,看到栏(但看起来不一样,我很高兴,截屏)我的屏幕截图有工作栏,但现在它消失了,我不知道为什么. 告诉我,可能是什么问题,为什么这些面板不同(对我和 Facebook 而言),也许我错过了使用与 FB 相同的栏的方法?

标签: javascripthtmlios

解决方案


您需要配置智能应用横幅,请阅读以下内容:https ://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners了解完整详情。首先,您需要在希望横幅出现的每个页面的 head 元素中添加此元标记:

<meta name="apple-itunes-app" content="app-id=myAppStoreID, app-argument=myURL">

然后在您的应用程序委托中实现 application(_:open:sourceApplication:annotation:) ,您可以在其中提供可以解释您传递的 URL 的逻辑,这是来自 Apple 网站的示例:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    // In this example, the URL from which the user came is http://example.com/profile/?12345.

    // Determine whether the user was viewing a profile.
    if ([[url path] isEqualToString:@"/profile"]) {

        // Switch to the profile view controller.
        [self.tabBarController setSelectedViewController:profileViewController];

        // Pull the profile ID number found in the query string.
        NSString *profileID = [url query];

        // Pass the profile ID number to the profile view controller.
        [profileViewController loadProfile:profileID];

    }
    return YES;
}

推荐阅读