Instance Method

insertQuantity:date:error:

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

Declaration

- (BOOL)insertQuantity:(HKQuantity *)quantity date:(NSDate *)date error:(NSError * _Nullable *)error;

Parameters

quantity

The quantity to insert.

date

The start date associated with the quantity. If this is the same start date as a previously provided quantity, this quantity replaces the previous one.

Fails with an HKErrorInvalidArgument error if the date parameter 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

This method calls insertQuantity:dateInterval:error:, passing a date interval with the provided start date, and a duration of 0.

See Also

Adding Values

- insertQuantity:dateInterval:error:

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