在不提示手表的情况下检查用户是否已连接 AppleWatch [英] Check if user has AppleWatch connected without prompting the watch

查看:45
本文介绍了在不提示手表的情况下检查用户是否已连接 AppleWatch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 Google Analytics,并想知道有多少用户拥有 AppleWatch.我在 Stack 中搜索了答案,重复出现的答案是使用这个:

We are using Google Analytics, and want to know how many of our users are in possession of an AppleWatch. I have searched Stack for answers, and the recurring answer is to use this:

if WCSession.isSupported() { // check if the device support to handle an Apple Watch
        let session = WCSession.defaultSession()
        session.delegate = self
        session.activateSession() // activate the session

        if session.paired { // Check if the iPhone is paired with the Apple Watch
                // Do stuff
        }
    }

问题在于它会提示用户'接受'AppleWatch 上的应用程序.诚然,无论用户是否接受,if 语句都是正确的,但我不希望用户抱有希望,认为该应用程序支持 AppleWatch.我只是想知道用户是否有 AppleWatch,我不想使用它.然而.iOS 设备上是否有一个属性可以访问以显示用户是否已经或曾经连接过 AppleWatch,而无需通过 Watch 提示用户?

The problem with this is that it prompts the user to 'accept' the app on the AppleWatch. Granted, the if-statement is true wether or not the user accepts, but I don't want the user to get their hopes up, thinking the app supports AppleWatch. I simply want to know if the user has an AppleWatch, I don't want to use it. Yet. Is there a property on the iOS-device that can be accessed to show if the user has or ever had an AppleWatch connected, without prompting the user through the Watch?

推荐答案

或许你可以使用 (Push)Notifications,因为不需要开发原生的 Applewatch 应用程序来接收手表上的通知.例如,我在手表上收到whats app 消息",但手表上也没有任何本机应用程序.

Probably you can use (Push)Notifications, since there is no need to develop a native applewatch app to receive notifications on the watch. For example i receive "whats app messages" on my watch, but it does not have any native app on the watch either.

在您的 watchkit 扩展 ExtensionDelegate.m 中,您可以单独处理为推送消息提供的答案.苹果链接

In your watchkit extension ExtensionDelegate.m you can handle provided answers to the push message separately. Link to Apple

这将是一种(另一种)方法,您必须要有创意!

This would be a(nother) approach, where you have to be creative!

这篇关于在不提示手表的情况下检查用户是否已连接 AppleWatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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