Initializes a new device object.
- iOS 9.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
A string containing the user-facing name for the device.
A string containing the device manufacturer’s name.
A string containing the device’s model name.
A string identifying the hardware version for the device.
A string identifying the version of the firmware that is installed on the device.
A string identifying the version of the software that is running on the device.
A string that uniquely identifies the device. Each health and fitness peripheral should have a separate local identifier for each iOS device it connects to. For example, a heart-rate monitor would have a different identifier when connected to Apple Watch than when connected to iPhone.
If the device object represents a medical device, use the device identifier portion of the Food and Drug Administration Unique Device Identifier (UDI). If the device does not have a UDI, pass
A newly initialized device object that encapsulates the provided data.
Use this method to create a device object representing an arbitrary piece of hardware. In general, the values for these parameters should match the information broadcasted by the hardware.
When creating device objects for use in queries, only pass in values for the parameters you need for your search. When used in a predicate, HealthKit finds all devices that match the non-
nil parameters. This gives you a great deal of control when it comes to fine-tuning your search. For example, setting the
local and the
firmware parameters lets you query for all the samples generated by a specific device running a specific version of the firmware. Just setting the
model casts a much broader net. For more information on querying for device-specific samples, see
When creating devices for new samples, it is best to provide values for as many parameters as you can. Even if you aren’t interest in a particular parameter, other apps may use it in their queries. More importantly, your app may need to use it in the future.