Reputation: 559
I want to get value of updatable characteristics for particular accessory.
So I am using func accessory(accessory: HMAccessory!, service: HMService!, didUpdateValueForCharacteristic characteristic: HMCharacteristic!)
method.
But this method is not called. Another method from same delegate is being called. What should be the problem?
Upvotes: 3
Views: 884
Reputation: 892
Enabled notification for the characteristic in viewWillAppear.
for (HMCharacteristic *thisCharacteristic in characteristicsArray) {
if ([thisCharacteristic.properties containsObject:HMCharacteristicPropertySupportsEventNotification]) {
[thisCharacteristic enableNotification:TRUE completionHandler:^(NSError *error) {
if (error) {
NSLog(@"Error while enabling notification");
}
else {
NSLog(@"Notification enabled");
}
}];
}
Also Disable the notification in viewWillDisappear
Upvotes: 13