Instance Method

insertQuantity:dateInterval:error:

Adds a new quantity to the series with the provided date interval.

Declaration

- (BOOL)insertQuantity:(HKQuantity *)quantity dateInterval:(NSDateInterval *)dateInterval error:(NSError * _Nullable *)error;

Parameters

quantity

The quantity to insert.

dateInterval

The date interval associated with the quantity. If the interval’s startDate parameter is the same as the start date for a previously provided quantity, this quantity replaces the previous one.

Fails with an HKErrorInvalidArgument error if the interval’s startDateTime property is earlier than the series builder’s startDate property.

error

If an error occurs, the system sets this parameter to an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.

Discussion

Use this method to add a quantity to the series. The quantity must have a unit that is compatible with the series builder’s quantity type (see isCompatibleWithUnit:).

See Also

Adding Values

- insertQuantity:date:error:

Adds a new quantity to the series at the provided date and time.