【问题标题】:How to make the "Open in the app" IOS bar on the website?如何在网站上制作“在应用程序中打开”IOS栏?
【发布时间】:2021-10-23 17:43:42
【问题描述】:

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

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

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

【问题讨论】:

    标签: javascript html ios


    【解决方案1】:

    您需要配置智能应用横幅,请阅读: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;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-11
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 1970-01-01
      • 2019-10-08
      • 2016-10-10
      • 1970-01-01
      相关资源
      最近更新 更多