首页 > 其他 > 详细

HomeKit点滴

时间:2017-11-27 22:45:03      阅读:316      评论:0      收藏:0      [点我收藏+]

最近在研究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

HomeKit点滴

原文:http://www.cnblogs.com/fphuang/p/7906394.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!