Instance Method


Requests permission to save and read the data types specified by an extension.


- (void)handleAuthorizationForExtensionWithCompletion:(void (^)(BOOL success, NSError *error))completion;



A block that is called after the user finishes responding to the request. This block is passed the following parameters:


A Boolean value that indicates whether the user responded to the prompt (if any). This value does not indicate whether permission was actually granted. This parameter is NO if the user canceled the prompt without selecting permissions; otherwise, YES.


An error object. If an error occurred, this object contains information about the error; otherwise, it is set to nil.


The host app must implement the application delegate’s applicationShouldRequestHealthAuthorization: method. This delegate method is called after an app extension calls requestAuthorizationToShareTypes:readTypes:completion:. The host app is then responsible for calling handleAuthorizationForExtensionWithCompletion:. This method prompts the user to authorize both the app and its extensions for the types that the extension requested.

The system performs this request asynchronously. After the user has finished responding, this method calls its completion block on a background queue. If the user has already chosen to grant or prohibit access to all of the types specified, the completion is called without prompting the user.

See Also

Accessing HealthKit

- authorizationStatusForType:

Returns the app’s authorization status for sharing the specified data type.


Constants indicating the authorization status for a particular data type.

- getRequestStatusForAuthorizationToShareTypes:readTypes:completion:

Indicates whether the system presents the user with a permission sheet if your app requests authorization for the provided types.


Values that indicate whether your app needs to request authorization from the user.

+ isHealthDataAvailable

Returns a Boolean value that indicates whether HealthKit is available on this device.

- supportsHealthRecords

Returns a Boolean value that indicates whether the current device supports clinical records.

- requestAuthorizationToShareTypes:readTypes:completion:

Requests permission to save and read the specified data types.