我能从iOS应用切换到Apple Watch吗?

时间:2021-06-19 01:22:08

I know that you can handoff from the Watch to the iOS App, but I have a use-case where I want to do this the other way round.

我知道你可以从手表切换到iOS应用程序,但我有一个用例,我想用另一种方式来做。

The user would create a set of rules on the phone using a more involved UI than would be possible on the watch, then handoff to the watch (deliberately, with something like a "send to watch" button) in order to monitor the results of their settings periodically on the Watch over the next 30 minutes or so.

用户将创建一组规则在电话里可能比使用更复杂的UI上的手表,然后切换到手表(故意,类似“发送观看”按钮),以监测结果的设置定期看未来30分钟左右。

Is this possible, and if so how do you do it?

这可能吗?如果可能的话,你怎么做呢?

1 个解决方案

#1


0  

Directly using Handoff is not possible from iPhone to Apple Watch, because watchOS doesn't have any UI or code to show handoff apps from iPhone.

从iPhone到Apple Watch直接使用切换是不可能的,因为watchOS没有任何UI或代码来显示iPhone的切换应用。

To have a similar effect, you could do one of the followings:

要达到类似的效果,你可以做以下的事情:

1- You could simply tell the user to open Watch app. If the user opens it, it could connect to iOS app to receive Handoff data.

1-你可以简单地告诉用户打开手表app,如果用户打开它,它可以连接iOS应用程序接收切换数据。

2- You can save data to Apple Watch by WatchConnectivity or in iCloud. Then, anytime the user opens the Watch app, it can receive data from iCloud or WatchConnectivity, no matter it is a minute later or a week.

2-你可以通过WatchConnectivity或iCloud将数据保存给Apple Watch。然后,无论用户何时打开手表应用,它都可以从iCloud或WatchConnectivity接收数据,无论是一分钟后还是一周后。

Note

请注意

You need to check whether the app is installed, or if there is a paired Apple Watch first:

你需要检查app是否已经安装,或者是否有配对的Apple Watch:

Swift

斯威夫特

import WatchConnectivity

if WCSession.isSupported(){
    if WCSession.defaultSession().watchAppInstalled{
        //...
    }
}

Objective-C

objective - c

#import <WatchConnectivity/WatchConnectivity.h>

if ([WCSession isSupported]){
    if ([WCSession defaultSession].watchAppInstalled){
        //...
    }
}

#1


0  

Directly using Handoff is not possible from iPhone to Apple Watch, because watchOS doesn't have any UI or code to show handoff apps from iPhone.

从iPhone到Apple Watch直接使用切换是不可能的,因为watchOS没有任何UI或代码来显示iPhone的切换应用。

To have a similar effect, you could do one of the followings:

要达到类似的效果,你可以做以下的事情:

1- You could simply tell the user to open Watch app. If the user opens it, it could connect to iOS app to receive Handoff data.

1-你可以简单地告诉用户打开手表app,如果用户打开它,它可以连接iOS应用程序接收切换数据。

2- You can save data to Apple Watch by WatchConnectivity or in iCloud. Then, anytime the user opens the Watch app, it can receive data from iCloud or WatchConnectivity, no matter it is a minute later or a week.

2-你可以通过WatchConnectivity或iCloud将数据保存给Apple Watch。然后,无论用户何时打开手表应用,它都可以从iCloud或WatchConnectivity接收数据,无论是一分钟后还是一周后。

Note

请注意

You need to check whether the app is installed, or if there is a paired Apple Watch first:

你需要检查app是否已经安装,或者是否有配对的Apple Watch:

Swift

斯威夫特

import WatchConnectivity

if WCSession.isSupported(){
    if WCSession.defaultSession().watchAppInstalled{
        //...
    }
}

Objective-C

objective - c

#import <WatchConnectivity/WatchConnectivity.h>

if ([WCSession isSupported]){
    if ([WCSession defaultSession].watchAppInstalled){
        //...
    }
}