Post

Replies

Boosts

Views

Activity

Accessory Notification method not called
Hello,I have a class CLightBulb and it is defined as a accessory delegate:class CLightBulb: NSObject, HMAccessoryDelegateIn the “init?()” I set self as the delegate:m_lightBulb.delegate = selfAnd I override the “didUpdateValueFor” method as follows, but it is never invoked when I turn a lightbulb on or off from the Homekit app on another device (other than the one I am testing on) //_______________________________ // AccessoryDelegate: Update Characteristic Value // // //_____ func accessory(_ accessory: HMAccessory, service: HMService, didUpdateValueFor characteristic: HMCharacteristic) { var results: CResults print("******------> CLightBulb AccessoryDelegate: Update Characteristic View") results = CResults() if ((accessory == m_lightBulb) && (service == m_lightBulbService)) { switch characteristic.characteristicType { case HMCharacteristicTypePowerState: results = GetThePowerStateFromTheLightBulb(workComplete: { () in let delegate = self.m_delegate if (results.GetResultCode() != CResults.code.success) { // NOTE: The attribute value is incorrect for Philips HUE bulbs so we have to check the error description // to see if the reason for the error is that its unreachable. It's not really an error if its unreachable if (self.m_isReachable == false) { delegate?.lightBulbReachablilityChanged!(device: self, newState: self.m_isReachable) } else { delegate?.lightBulbEncounteredError(device: self, opResults: results) } } else { delegate?.lightBulbPowerStateChanged!(device: self, newState: self.m_powerState) } }) default: print("CLightBulb: Encountered unexpected service type in accessory characteristic update.") } } }But when I test my app on my phone, it doesn’t get called when I, say, turn the light bulb off from the Homekit app on my iPad. Do you know what I’m missing?
7
0
3.0k
May ’18
OAuth using ASWebAuthenticationSession, redirect URI
Hello, My app uses OAuth to connect to two services. To get the authorization ocde, originally, they both allowed a URI in the form of "com.SmartVentsTwo://auth". Now, the second one changed and requires that the URI be a complete URL starting with HTTPS. Needless to say the second stopped working. I read several different articles and posts about this difference telling me a range of things to do from simply adding "https://com.SSmarVentsTwo://auth" to the URL types in the project settings, to creating a redirect from my website. It would seem the most secure would be the former since it doesn't require extra jumps, but it didn't work. When I tried it, after logging in and authorizing the request, i got a "could not find server" error. What are the exact steps I need to follow to accommodate the change? (Thank you very much!!)
7
0
1.2k
Apr ’24