zoukankan      html  css  js  c++  java
  • HomeKit点滴

    最近在研究HomeKit,在更改某个特征值的时候:

    当设置了HMAccessoryDelegate的delegate后,在App中,改变HMCharacteristic的特征值时,

    - (void)writeValue:(nullable id)value completionHandler:(void (^)(NSError * __nullable error))completion;

    代理方法

    - (void)accessory:(HMAccessory *)accessory service:(HMService *)service didUpdateValueForCharacteristic:(HMCharacteristic *)characteristic

    是不会被触发的。

    那么该方法在什么时候被触发呢?当App运行时,特征值被从他的途径修改的时候,比如通过设备的物理开关,才会触发App的改代理方法,目的是App UI与设备保持一致。

    详细可参见苹果官方的描述:

    Discussion
    This method is called as a result of a change in value initiated by the accessory. Programmatic changes initiated by the app do not result in this method being called.

    https://developer.apple.com/documentation/homekit/hmaccessorydelegate/1615286-accessory?language=objc

  • 相关阅读:
    链表-(1)
    爬虫(10-3)验证码图片识别
    爬虫10-2(多线程爬虫)
    分布式爬虫系统的架构(19)
    pipenv管理Python虚拟环境
    peewee-async集成到tornado
    Python3笔记051
    Python3笔记050
    Python3笔记049
    Python3笔记048
  • 原文地址:https://www.cnblogs.com/fphuang/p/7906394.html
Copyright © 2011-2022 走看看