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

查看:100
本文介绍了在不提示手表的情况下检查用户是否已连接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应用程序即可在手表上接收通知.例如,我在手表上收到什么应用程序消息",但手表上也没有任何本机应用程序.

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.

在您的监视包扩展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天全站免登陆