可以从我的应用程序启动Apple的默认天气应用程序吗?
我的一位客户想要从我们的应用程序中打开 Apple 的本机天气应用程序。几次之后,我没有看到可能的方法,除非我们需要使用任何提供自定义 url 方案的第三方应用程序。
如果有人的话那就太好了如果可能的话请确认或给我一个线索。
One of my client wants to open Apple's native weather app from our application. After few I don't see a possible way, unless we need to go with any 3rd party apps which provides custom url scheme.
It would be great if someone confirm or give me a lead if it is possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是不可能的,天气应用程序没有已知的 URL 方案,我怀疑它有一个未知的 URL 方案。
Its not possible, the weather app doesn't have a known URL scheme and I dubt that it has an unknown one.
handleOpenURL 网站是自定义 iOS URL 方案的绝佳资源; 使用此链接搜索已知的 Apple 应用方案。
不幸的是,天气应用程序不在其中。
另外几个带有方案的网站(handleOpenURL 似乎是最完整的,但检查其他网站也没什么坏处):
应用查找
Akosma iPhone URL Scheme Wiki
The website handleOpenURL is an excellent resource for custom iOS URL schemes; use this link to search for the known Apple app schemes.
Unfortunately the weather app is not among them.
Another couple of sites with schemes (handleOpenURL seems to be the most complete, but it can't hurt to check the others):
app lookup
Akosma iPhone URL Scheme Wiki
至少在设备上的 iOS 16.4 和 macOS Ventura 中,您可以打开如下 URL,它将充当通用链接并打开本机天气应用程序,显示天气关闭给定的坐标。
https://weather.apple.com/?lat=50.237&long =-122.022
我通过使用模拟器上的地图应用程序并长按天气徽章发现了这个 URL。这会弹出一个更大的天气面板,如果您点击该 Maps.app 会尝试打开 URL,但在模拟器上会失败。
At least with iOS 16.4 on device and in macOS Ventura you can open a URL like the following and it will act as a Universal Link and open the native Weather app showing weather close the given coordinate.
https://weather.apple.com/?lat=50.237&long=-122.022
I discovered this URL by using the Maps app on the simulator and long pressing the weather badge. This brings up a larger weather panel and if you tap that Maps.app tries to open the URL but fails on the simulator.
您可以使用以下 URL 打开天气应用程序:weather://
这是我开始工作的 codepen 演示: https://codepen.io/irom1/pen/KKeZBMW
You can open the weather app with this URL: weather://
Here is a codepen demo I got to work: https://codepen.io/irom1/pen/KKeZBMW
如果其他人正在寻找答案:weather://weather.apple.com/?lat=37.323&long=-122.03218 为我做到了。这样您就可以链接到特定位置。
If someone else is searching for an answer: weather://weather.apple.com/?lat=37.323&long=-122.03218 did it for me. This way you can link to a specific location.