如何以编程方式从iOS应用程序打开Apple Watch配套应用程序 [英] How to programmatically open Apple Watch companion app from iOS app

查看:122
本文介绍了如何以编程方式从iOS应用程序打开Apple Watch配套应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向用户提示,我的iOS应用程序支持Apple Watch。

I would like to give a hint to the user, that my iOS app supports the Apple Watch.

所以我想从我的iOS应用程序中链接/打开Apple Watch配套应用程序,非常类似于使用(打开设置应用程序[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

So I would like to link/open the Apple Watch companion app from within my iOS app, very much similar to opening the Settings App using ([[UIApplication sharedApplication] openURL: [NSURL URLWithString:UIApplicationOpenSettingsURLString]];)

这将使用户能够直接导航到Watch伴侣应用程序为手表设置我的应用程序。

This shall enable the user to directly navigate to the Watch companion app to setup my app for the watch.

我找不到任何可以打开常用应用程序或特定于配套应用程序部分的URL。

I could not find any URL which would open the companion app in general or specific to a section of the companion app.

如果不支持直接链接,我也对此用例的替代方法感兴趣。

If direct linking is not supported, I am also interested in alternative approaches for this use case.

提前致谢!

编辑:
我检查了模拟器中的WatchKitSettings Info.plist文件,看它是否注册了任何URL架构,但是它没有。

I checked the WatchKitSettings Info.plist file in the simulator to see if it registers any URL schema, but it does not.

推荐答案

我想不可能以编程方式从iOS启动手表伴侣应用程序。相反的方式是可能的:在收到来自手表的消息后在后台启动iOS应用程序。请参阅WWDC演讲介绍Watch Connectivity

I guess it's not possible to programmatically launch the watch companion app from iOS. The opposite way would be possible: to launch the iOS app in the background upon receiving a message from the watch. See WWDC talk Introducing Watch Connectivity.

你可以检查 WCSession.defaultSession()。watchAppInstalled 并要求用户启动应用程序,如果它是真的。

You could check WCSession.defaultSession().watchAppInstalled and ask the user to launch the app if it is true.

这篇关于如何以编程方式从iOS应用程序打开Apple Watch配套应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆