简体   繁体   English

如何在网站上制作“在应用程序中打开”IOS栏?

[英]How to make the "Open in the app" IOS bar on the website?

I need to add the same bar(the top one, sorry for RU lang, the bar is using OS language, anyway Открыть equals Open) FB example , as far as I understand, it is native, so i found a way to add if, adding to我需要添加相同的栏(最上面的,抱歉 RU lang,该栏使用操作系统语言,反正 Открыть 等于 Open) FB 示例,据我所知,它是本地的,所以我找到了一种方法来添加如果, 添加到

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

After downloading the application and deploying the site locally, I opened it from an iPhone, saw the bar(but it looked different, I was happy, made a screenshot) My screenshot with working bar , but now it has disappeared and I dont know why.下载应用程序并在本地部署网站后,我用 iPhone 打开它,看到了这个栏(但看起来不一样,我很高兴,截图了)我的截图有工作栏,但现在它消失了,我不知道为什么. Tell me, what could be the problem, why are these panels different(for me and for facebook), maybe I missed a way to use same bar as FB did?告诉我,可能是什么问题,为什么这些面板不同(对我和 facebook),也许我错过了使用与 FB 相同的栏的方法?

You need to configure a smart app banner, read this: https://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners for full details.您需要配置一个智能应用程序横幅,请阅读: https://developer.apple.com/documentation/webkit/promoting_apps_with_smart_app_banners了解完整详情。 First you need to add this meta tag in the head element of each page you'd like the banner to appear:首先,您需要在希望显示横幅的每个页面的 head 元素中添加此元标记:

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

Then implement application(_:open:sourceApplication:annotation:) in your app delegate in which you provide logic that can interpret the URL you pass, this an example from Apple site:然后在你的应用程序委托中实现 application(_:open:sourceApplication:annotation:) ,你在其中提供可以解释你传递的 URL 的逻辑,这是来自苹果网站的一个例子:

- (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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM