从 iOS 上的链接打开 Instagram 应用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39812072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:25:44  来源:igfitidea点击:

Opening Instagram app from a link on iOS

iosinstagram

提问by Josh Santangelo

I am providing a feed which is consumed by both desktop and mobile apps which contains links to images, users, and tags on Instagram. When these links are clicked on iOS, I want them to open in the Instagram app.

我提供了一个供桌面和移动应用程序使用的提要,其中包含指向 Instagram 上图像、用户和标签的链接。当在 iOS 上点击这些链接时,我希望它们在 Instagram 应用程序中打开。

Currently if I have a link like this: https://www.instagram.com/p/BK8f1rigadE/

目前,如果我有这样的链接:https: //www.instagram.com/p/BK8f1rigadE/

If I click it in iOS, the Instagram app does open, just briefly. It then seems to launch Safari to the page, which includes an "open in app" link to open it back up in the app. That link uses the "instagram://" protocol to trigger the app to open. I'm aware of that method, but that's not what I'm after.

如果我在 iOS 中点击它,Instagram 应用程序会打开,只是简单地打开。然后它似乎将 Safari 启动到该页面,其中包含一个“在应用程序中打开”链接以在应用程序中将其打开。该链接使用“ instagram://”协议来触发应用程序打开。我知道这种方法,但这不是我所追求的。

I'm on iOS 10 with the latest Instagram app. I feel like this used to work, so I'm wondering if it's just a bug in iOS or Instagram that will be fixed eventually.

我在 iOS 10 上使用最新的 Instagram 应用程序。我觉得这曾经有效,所以我想知道它是否只是 iOS 或 Instagram 中的一个错误,最终会被修复。

Links to twitter.com open properly in the Twitter app... that's the kind of behavior I'm after.

twitter.com 的链接在 Twitter 应用程序中正确打开......这就是我所追求的那种行为。

回答by 0Seven

I found a service called URL Genius(via this blog post) that solves this exact problem, and provides click metrics, too.

我找到了一个名为URL Genius的服务(通过这篇博文),它解决了这个确切的问题,并提供了点击指标。

I don't like relying on an external service for such an important link, but it's easy, works well, and the basic service is free. I will probably set a reminder for myself to check that this still works every month or so...

这么重要的环节我不喜欢依赖外部服务,但是很简单,效果很好,基本服务是免费的。我可能会为自己设置一个提醒来检查这是否每个月左右仍然有效......

回答by Josh Santangelo

Links like this work to open the app: instagram://media?id=1346423547953773636_401375631

像这样的链接可以打开应用程序: instagram://media?id=1346423547953773636_401375631

However I want a regular http link, which opens a browser on desktop, and the app on mobile. Not sure if it exists.

但是我想要一个常规的 http 链接,它可以在桌面上打开浏览器,在移动设备上打开应用程序。不确定它是否存在。

回答by BHendricks

From my knowledge, the only supported links into Instagram are described here

据我所知,这里描述了唯一受支持的 Instagram 链接

I'm not sure what the link you're attempting to use represents: /p/id_hereseems like a post? You likely need to use:

我不确定您尝试使用的链接代表什么:/p/id_here看起来像帖子?您可能需要使用:

https://www.instagram.com/media?id=id_here

https://www.instagram.com/media?id=id_here

The documentation I linked shows the "deeplink" approach (instagram://) which I understand you're avoiding, but the same paths should work through the Universal Linkapproach, at least from my experience.

我链接的文档显示了“深层链接”方法 ( instagram://),我知道您正在避免这种Universal Link方法,但至少根据我的经验,相同的路径应该通过该方法起作用。