javascript - 如何在网站上制作“在应用程序中打开”IOS栏?
问题描述
我需要添加相同的栏(最上面的,对不起RU lang,栏使用OS语言,反正Открыть等于Open)FB示例,据我了解,它是原生的,所以我找到了一种添加if的方法, 添加到
<meta name="apple-itunes-app" content="app-id=MyAppId(it exists on app store)">
下载应用程序并在本地部署站点后,我从 iPhone 打开它,看到栏(但看起来不一样,我很高兴,截屏)我的屏幕截图有工作栏,但现在它消失了,我不知道为什么. 告诉我,可能是什么问题,为什么这些面板不同(对我和 Facebook 而言),也许我错过了使用与 FB 相同的栏的方法?
解决方案
您需要配置智能应用横幅,请阅读以下内容: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;
}
推荐阅读
- hyperledger-fabric - 如何更新事务处理器函数中的关系值?
- java - 通过单击查看检查是否使用 Espresso 启动了新活动
- mysql - SELECT subCategory 等于 parentCategory = 外部表中的值
- matlab - 所有质心坐标组合之间的成对距离 - Matlab
- javascript - 窗口位置替换只工作一次
- python - from kivy.core.window._window_sdl2 import _WindowSDL2Storage [CRITICAL] [App] 无法获取窗口,中止
- selenium - 通过 Selenium 脚本单击网页上的链接元素时出错
- python - 使用 :-1 和 None 切片 - 每个语句的含义是什么?
- c++ - 尝试反转链表时显示分段错误
- c# - 脚手架现有数据库时 ASP.NET Core 3.0 错误“无法转换类型的对象”