ios - Healthkit permission limit to 20 -
i have integrated health kit project , working fine, when read 8 health kit records. need records, application asks permission 20 health kit type identifiers.
can read health kit data? need special permission?
here code tried:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     [self requestauthorization]; }  - (void)requestauthorization {     if ([hkhealthstore ishealthdataavailable]) {          nsset *writedatatypes = [self datatypestowrite];         nsset *readdatatypes = [self datatypestoread];          [self.healthstore requestauthorizationtosharetypes:writedatatypes readtypes:readdatatypes completion:^(bool success, nserror *error) {             if (!success) {                 nslog(@"you didn't allow healthkit access these read/write data types. in app[][1]. error was: %@.", error);                  return;             }         }];     } }   - (nsset *)datatypestoread {      hkquantitytype *heighttype = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierheight];     hkquantitytype *weighttype = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbodymass];     hkquantitytype *systolic = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbloodpressuresystolic];     hkquantitytype *dystolic = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbloodpressurediastolic];     hkcategorytype *sleepanalysis = [hkobjecttype categorytypeforidentifier:hkcategorytypeidentifiersleepanalysis];     hkquantitytype *step = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierstepcount];     hkquantitytype *walking = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdistancewalkingrunning];     hkquantitytype *cycling = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdistancecycling];     hkquantitytype *basalenergyburned = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbasalenergyburned];      hkquantitytype *activeenergyburned = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifieractiveenergyburned];     hkquantitytype *heartrate = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierheartrate];     hkquantitytype *bodytemp = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbodytemperature];     hkquantitytype *basaltemp = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbasalbodytemperature];     hkquantitytype *biotin = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarybiotin];     hkquantitytype *bloodalcohol = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbloodalcoholcontent];     hkquantitytype *bloodglucose = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbloodglucose];     hkquantitytype *bodyfat = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierbodyfatpercentage];     hkquantitytype *caffeine = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarycaffeine];     hkquantitytype *calcium = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarycalcium];     hkquantitytype *carbohydrates = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarycarbohydrates];     hkquantitytype *cervicalmucusquality = [hkobjecttype quantitytypeforidentifier:hkcategorytypeidentifiercervicalmucusquality];     hkquantitytype *chloride = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarychloride];     hkquantitytype *chromium = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarychromium];     hkquantitytype *copper = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietarycopper];     hkquantitytype *dietaryenergy = [hkobjecttype quantitytypeforidentifier:hkquantitytypeidentifierdietaryenergyconsumed];      return [nsset setwithobjects:  heighttype, weighttype, systolic, dystolic, sleepanalysis, step, walking, cycling, basalenergyburned, activeenergyburned, heartrate, bodytemp, basaltemp, biotin, bloodalcohol, bloodglucose, bodyfat, caffeine, calcium, carbohydrates, cervicalmucusquality, chloride, chromium, copper, dietaryenergy, nil]; }      
once app has prompted authorization types, cannot prompt again types again until authorization reset app. there 2 ways can reset authorization:
- uninstall , re-install app.
 - tap reset location & privacy button in settings > general > reset.
 
Comments
Post a Comment