findVendorAccessory(hapPublicKey:completionHandler:)
Finds your vendor HAP accessory using its long-term public key.
Declaration
func findVendorAccessory(hapPublicKey: Data, completionHandler completion: @escaping @Sendable (HMAccessory?, (any Error)?) -> Void)func findVendorAccessory(hapPublicKey: Data) async throws -> HMAccessory?Parameters
- hapPublicKey:
The HAP long-term public key of the accessory with a length of 32 bytes.
- completion:
The block that HomeKit runs after the request completes. If HomeKit isn’t paired to a matching accessory, or if the current process doesn’t have access to the matching accessory, the completion block returns
nilinstead of an accessory. The completion block provides an error if you callfindVendorAccessory(hapPublicKey:completionHandler:)before Hmhomemanager can retrieve a home, such as before HomeKit calls the Homemanagerdidupdatehomes(_:) callback method.
Overview
Use findVendorAccessory(hapPublicKey:completionHandler:) to find out if your accessory is currently paired with HomeKit.