Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

HealthKit.RequestAuthorizationToShareTypes

Requests authorization from the user.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
HealthKit 8.2 No No No No Yes

MBS( "HealthKit.RequestAuthorizationToShareTypes"; ShareList; ReadList { ; FileName; ScriptName } )

Parameters

Parameter Description Example value
ShareList The list of sample types to share.
Can be empty if you just read.
""
ReadList The list of object types to read. "BiologicalSex¶BloodType"
FileName Optional
The file name of the script to call.
Get(FileName)
ScriptName Optional
The name of the script to trigger.
"AuthorizationCompleted"

Result

Returns OK or error.

Description

Requests authorization from the user.
Prompts the user to authorize the application for reading and saving objects of the given types.
Before attempting to execute queries or save objects, the application should first request authorization from the user to read and share every type of object for which the application may require access.
The request is performed asynchronously and its completion will be executed on an arbitrary background queue after the user has responded. If the user has already chosen whether to grant the application access to all of the types provided, then the completion will be called without prompting the user.

We call optionally your script to pass in the result. You get a list of values. First entry is Success or Cancel. Second value is the error message.
The success parameter of the completion indicates whether prompting the user, if necessary, completed successfully and was not cancelled by the user. It does NOT indicate whether the application was granted authorization.

To customize the messages displayed on the authorization sheet, set the following keys in your app's Info.plist file. Set the NSHealthShareUsageDescription key to customize the message for reading data.
Set the NSHealthUpdateUsageDescription key to customize the message for writing data.

Supported quantity types:

  • Body Measurements: BodyFatPercentage, BodyMass, BodyMassIndex, Height, LeanBodyMass, WaistCircumference.
  • Fitness: StepCount, DistanceWalkingRunning, DistanceCycling, DistanceWheelchair, BasalEnergyBurned, ActiveEnergyBurned, FlightsClimbed, NikeFuel, AppleExerciseTime, PushCount, DistanceSwimming, SwimmingStrokeCount, VO2Max.
  • Vitals: HeartRate, BodyTemperature, BasalBodyTemperature, BloodPressureSystolic, BloodPressureDiastolic, RespiratoryRate.
  • Results: OxygenSaturation, PeripheralPerfusionIndex, BloodGlucose, NumberOfTimesFallen, ElectrodermalActivity, InhalerUsage, InsulinDelivery, BloodAlcoholContent, ForcedVitalCapacity, ForcedExpiratoryVolume1, PeakExpiratoryFlowRate.
Nutrition: DietaryFatTotal, DietaryFatPolyunsaturated, DietaryFatMonounsaturated, DietaryFatSaturated, DietaryCholesterol, DietarySodium, DietaryCarbohydrates, DietaryFiber, DietarySugar, DietaryEnergyConsumed, DietaryProtein, DietaryVitaminA, DietaryVitaminB6, DietaryVitaminB12, DietaryVitaminC, DietaryVitaminD, DietaryVitaminE, DietaryVitaminK, DietaryCalcium, DietaryIron, DietaryThiamin, DietaryRiboflavin, DietaryNiacin, DietaryFolate, DietaryBiotin, DietaryPantothenicAcid, DietaryPhosphorus, DietaryIodine, DietaryMagnesium, DietaryZinc, DietarySelenium, DietaryCopper, DietaryManganese, DietaryChromium, DietaryMolybdenum, DietaryChloride, DietaryPotassium, DietaryCaffeine, DietaryWater.
  • UVExposure

Sample Types include Quantity types plus:

  • Workout
  • * SleepAnalysis, AppleStandHour, CervicalMucusQuality, OvulationTestResult, MenstrualFlow, IntermenstrualBleeding, SexualActivity and MindfulSession.
  • BloodPressure and CDA.

Object Types include all above plus:

  • activitySummary
  • BiologicalSex
  • BloodType
  • DateOfBirth
  • FitzpatrickSkinType
  • WheelchairUse

Please enable HealthKit for the app entitlements for Xcode, add HealthKit framework and set NSHealthShareUsageDescription descriptor for info.plist.

Examples

Request authorization:

Set Variable [ $r ; Value: MBS( "HealthKit.RequestAuthorizationToShareTypes"; ""; "BiologicalSex¶BloodType¶WheelchairUse¶DateOfBirth¶FitzpatrickSkinType¶StepCount" ; Get(FileName); "AuthorizeTrigger" ) ]
If [ $r ≠ "OK" ]
    Show Custom Dialog [ "Error" ; $r ]
End If

See also

Created 25th April 2018, last changed 9th August 2018


HealthKit.FitzpatrickSkinType   -   HealthKit.SampleQuery

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins