91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-09
  • 語(yǔ)言: 其他
  • 標(biāo)簽:

資源簡(jiǎn)介

獲取iOS系統(tǒng)健康數(shù)據(jù):卡路里,步數(shù)等。步數(shù)可以獲取一個(gè)時(shí)間段,或者實(shí)時(shí)獲取當(dāng)天步數(shù),自己設(shè)置。參考:http://blog.csdn.net/doing111/article/details/45167317#comments

資源截圖

代碼片段和文件信息

//
//??HealthManager.m
//??zoubao
//
//??Created?by?李聰?on?15/4/20.
//??Copyright?(c)?2015年?李聰.?All?rights?reserved.
//

#import?“HealthManager.h“
#import?
#import?“HKHealthStore+AAPLExtensions.h“

#define?HKVersion?[[[UIDevice?currentDevice]?systemVersion]?doubleValue]
@implementation?HealthManager

+(id)shareInstance
{
????static?id?manager?;
????static?dispatch_once_t?onceToken;
????dispatch_once(&onceToken?^{
????????manager?=?[[[self?class]?alloc]?init];
????});
????return?manager;
}

/*!
?*??@author?Lcong?15-04-20?17:04:44
?*
?*??@brief??檢查是否支持獲取健康數(shù)據(jù)
?*/
-?(void)getPermissions:(void(^)(BOOL?success))Handle
{
????if(HKVersion?>=?8.0)
????{
????????if?([HKHealthStore?isHealthDataAvailable])?{
????????????
????????????if(self.healthStore?==?nil)
????????????????self.healthStore?=?[[HKHealthStore?alloc]?init];
????????????
????????????/*
?????????????組裝需要讀寫的數(shù)據(jù)類型
?????????????*/
????????????NSSet?*writeDataTypes?=?[self?dataTypesToWrite];
????????????NSSet?*readDataTypes?=?[self?dataTypesRead];
????????????
????????????/*
?????????????注冊(cè)需要讀寫的數(shù)據(jù)類型,也可以在“健康”APP中重新修改
?????????????*/
????????????[self.healthStore?requestAuthorizationToShareTypes:writeDataTypes?readTypes:readDataTypes?completion:^(BOOL?success?NSError?*error)?{
????????????????if?(!success)?{
????????????????????DebugLog(@“%@\n\n%@“error?[error?userInfo]);
????????????????????return?;
????????????????}
????????????????else
????????????????{
????????????????????Handle(YES);
????????????????}
????????????}];
????????}
????}
}


/*!
?*??@author?Lcong?15-04-20?16:04:42
?*
?*??@brief??寫權(quán)限
?*
?*??@return?集合
?*/
-?(NSSet?*)dataTypesToWrite
{
????//????HKQuantityType?*heightType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierHeight];
????//????HKQuantityType?*weightType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass];
????//????HKQuantityType?*temperatureType?=?[HKQuantityType?quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyTemperature];
????//????HKQuantityType?*activeEnergyType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned];
????//
????//????return?[NSSet?setWithobjects:heightType?temperatureType?weightTypeactiveEnergyTypenil];
????
????return?[NSSet?setWithobjects:nil];
????
}


/*!
?*??@author?Lcong?15-04-20?16:04:03
?*
?*??@brief??讀權(quán)限
?*
?*??@return?集合
?*/
-?(NSSet?*)dataTypesRead
{
????HKQuantityType?*activeEnergyType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned];
????HKQuantityType?*heightType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierHeight];
????HKQuantityType?*weightType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass];
????HKQuantityType?*temperatureType?=?[HKobjectType?quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyTemperature];
????HKCharacteristicType?*birthdayType?=?[HKobjectType?characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierDateOfBirth];
????HKCha

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-08-18?16:25??Health\
?????文件????????1276??2015-04-21?17:29??Health\HealthManager.h
?????目錄???????????0??2015-11-24?15:31??__MACOSX\
?????目錄???????????0??2015-11-24?15:31??__MACOSX\Health\
?????文件?????????263??2015-04-21?17:29??__MACOSX\Health\._HealthManager.h
?????文件????????9635??2015-07-23?10:41??Health\HealthManager.m
?????文件?????????263??2015-07-23?10:41??__MACOSX\Health\._HealthManager.m
?????文件?????????575??2015-04-20?12:30??Health\HKHealthStore+AAPLExtensions.h
?????文件?????????263??2015-04-20?12:30??__MACOSX\Health\._HKHealthStore+AAPLExtensions.h
?????文件????????1520??2015-07-10?11:40??Health\HKHealthStore+AAPLExtensions.m
?????文件?????????263??2015-07-10?11:40??__MACOSX\Health\._HKHealthStore+AAPLExtensions.m
?????文件?????????212??2015-08-18?16:25??__MACOSX\._Health

評(píng)論

共有 條評(píng)論

相關(guān)資源