

{"id":1282,"date":"2018-02-23T17:31:07","date_gmt":"2018-02-23T08:31:07","guid":{"rendered":"https:\/\/curecode.jp\/tech\/?p=1282"},"modified":"2018-02-23T17:32:49","modified_gmt":"2018-02-23T08:32:49","slug":"ios-healthkit-getauthorizationstatus","status":"publish","type":"post","link":"https:\/\/curecode.jp\/tech\/ios-healthkit-getauthorizationstatus\/","title":{"rendered":"Xamarin.iOS HealthKit \u3068\u9023\u643a\u3059\u308b\u3068\u304d\u306e\u6a29\u9650\u30c1\u30a7\u30c3\u30af\u306f\u66f8\u304d\u8fbc\u307f\u7528"},"content":{"rendered":"<h3>\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u30a2\u30d7\u30ea\u3068\u9023\u643a\u3057\u305f\u3044<\/h3>\n<p>iPhone \u30a2\u30d7\u30ea\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u306f HealthKit store \u3068\u3044\u3046DB\u3078\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u66f8\u304d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u53c2\u8003\uff1a<a href=\"https:\/\/dev.classmethod.jp\/references\/health-healthkit-basics\/\" rel=\"noopener\" target=\"_blank\">[iOS 8] \u30d8\u30eb\u30b9\u30b1\u30a2 \u30a2\u30d7\u30ea\u3068HealthKit Framwork\u306e\u6fc3\u5bc6\u306a\u95a2\u4fc2<\/a>\u3001&nbsp;<a href=\"https:\/\/developer.apple.com\/documentation\/healthkit\" rel=\"noopener\" target=\"_blank\">Apple\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u300cHealthKit\u300d<\/a><\/p>\n<p>\u81ea\u5206\u3067\u958b\u767a\u4e2d\u306e\u30a2\u30d7\u30ea\u3068 iPhone \u30a2\u30d7\u30ea\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u3092\u9023\u643a\u3059\u308b\u969b\u306b\u306f\u3001\u3053\u306eDB\u3078\u306e\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u4ed8\u4e0e\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h3>\u4fdd\u5b58\u304a\u3088\u3073\u8aad\u307f\u53d6\u308b\u305f\u3081\u306e\u81ea\u52d5\u5316\u306e\u8981\u6c42 \u3068 \u66f8\u304d\u8fbc\u307f\u6a29\u9650<\/h3>\n<\/p>\n<p>\u7d50\u8ad6\u304b\u3089\u8a00\u3046\u3068\u3001\u8aad\u307f\u8fbc\u3080\u3060\u3051\u306a\u3089 <\/p>\n<ul>\n<li>HKHealthStore.RequestAuthorizationToShare()<br \/>\u307e\u305f\u306f<\/li>\n<li>HKHealthStore.RequestAuthorizationToShareAsync()<\/li>\n<\/ul>\n<p>\u306e\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u304a\u3088\u3073\u8aad\u307f\u53d6\u308b\u305f\u3081\u306e\u81ea\u52d5\u5316\u306e\u8a31\u53ef\u8981\u6c42\u306e\u307f\u304c\u3042\u308c\u3070\u3088\u304f\u3001<\/p>\n<ul>\n<li>HKHealthStore.GetAuthorizationStatus()<\/li>\n<\/ul>\n<p>\u3067\u53d6\u5f97\u3067\u304d\u308b Health \u30c7\u30fc\u30bf\u3092\u8aad\u307f\u66f8\u304d\u3059\u308b\u305f\u3081\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\u30b9\u30c6\u30fc\u30bf\u30b9\u306f\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u4e0a\u8a18\u7d50\u8ad6\u306b\u81f3\u308b\u307e\u3067\u306b\u30cf\u30de\u3063\u305f\u306e\u3067\u3059\u304c\u3001<\/p>\n<p><a href=\"https:\/\/developer.xamarin.com\/api\/type\/HealthKit.HKHealthStore\/\" rel=\"noopener\" target=\"_blank\">Xamarin.iOS\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306b\u306f<\/p>\n<blockquote><p>To validate access to a particular data type, developers must use the HKHealthStore.GetAuthorizationStatus method:<\/p><\/blockquote>\n<p>Google\u7ffb\u8a33\u3088\u308a<\/p>\n<p>\u300c\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u578b\u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u691c\u8a3c\u3059\u308b\u306b\u306f\u3001\u958b\u767a\u8005\u306fHKHealthStore.GetAuthorizationStatus\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u300d<\/p>\n<p>\u3068\u3042\u308b\u306e\u3067\u3001\u8aad\u307f\u8fbc\u307f\u3057\u304b\u3057\u306a\u3044\u6642\u306b\u3082\u6a29\u9650\u304c\u5fc5\u8981\u306a\u3082\u306e\u3068\u8aa4\u89e3\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u53c2\u8003\u30b5\u30a4\u30c8<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/39233297\/healthkit-requestauthorizationtosharereadcompletion-always-succeeds\" target=\"_blank\">https:\/\/stackoverflow.com\/questions\/39233297\/healthkit-requestauthorizationtosharereadcompletion-always-succeeds<\/a><br \/>\n\u306b\u3088\u308b\u3068\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u53d6\u5f97\u3067\u304d\u308b\u6a29\u9650\u72b6\u614b\u306f\u3001HealthKit store DB \u3078\u306e\u66f8\u304d\u8fbc\u307f\u306e\u6a29\u9650\u5c02\u7528\u3060\u305d\u3046\u3067\u3001\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u308b\u3068\u3001\u8aad\u307f\u8fbc\u307f\u6642\u306f\u6a29\u9650\u304c\u306a\u3051\u308c\u3070\u7a7a\u304c\u8fd4\u5374\u3055\u308c\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<h3>\u5b9f\u88c5\u4f8b\u306e\u4e00\u90e8<\/h3>\n<p>\u203b\u6b69\u6570\u306e\u8aad\u307f\u8fbc\u307f\u306e\u307f\u3067\u3059<\/p>\n<pre class=\"lang:default decode:true \" >\r\nif (HKHealthStore.IsHealthDataAvailable)\r\n{\r\n    healthKitStore = new HKHealthStore();\r\n    \/\/ \u6b69\u6570\u60c5\u5831\u3092\u30bb\u30c3\u30c8\r\n    var StepCountType = HKQuantityType.Create(HKQuantityTypeIdentifier.StepCount);\r\n    \r\n    \/\/ \u8aad\u307f\u66f8\u304d\u8a31\u53ef\u3092\u8981\u6c42\u3057\u305f\u3044\u30c7\u30fc\u30bf\u30bf\u30a4\u30d7\u3092\u30bb\u30c3\u30c8\r\n    var typesToWrite = new NSSet();\t\/\/ \u2190\u66f8\u304d\u8fbc\u307f\u306b\u306f\u7279\u306b\u4f55\u3082\u6307\u5b9a\u3057\u306a\u3044\r\n    var typesToRead = new NSSet(new[] { StepCountType });\r\n    \r\n    \/\/ \u6307\u5b9a\u3055\u308c\u305f\u30c7\u30fc\u30bf\u578b\u306e\u4fdd\u5b58\u3068\u8aad\u307f\u53d6\u308a\u306e\u81ea\u52d5\u8a31\u53ef\u3092\u8981\u6c42\u3057\u307e\u3059\u3002\r\n    healthKitStore.RequestAuthorizationToShare(\r\n        typesToWrite,\r\n        typesToRead,\r\n        (success, error) =>\r\n        {\r\n             if (success)\r\n             {\r\n                 \/\/ \u5f53\u30a2\u30d7\u30ea\u304c\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u30a2\u30d7\u30ea\u306e\u6b69\u6570\u306e\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u30a2\u30af\u30bb\u30b9\u300d\u753b\u9762\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u72b6\u614b\r\n                 \r\n                 \/\/ \u6b69\u6570\u306e\u6a29\u9650\u72b6\u614b\u3092\u53d6\u5f97\r\n                 \/\/ \u3053\u308c\u306fHealthKit store DB\u3078\u306e\u66f8\u304d\u8fbc\u307f\u6642\u306e\u6a29\u9650\u72b6\u614b\u306a\u306e\u3067\u8aad\u307f\u8fbc\u307f\u306e\u307f\u306e\u5834\u5408\u306f\u4e0d\u8981\r\n                 var access = healthKitStore.GetAuthorizationStatus(StepCountType);\r\n                 \r\n                 \/\/ \u53d6\u308a\u8fbc\u3080\u51e6\u7406\r\n                 GetSteps();\r\n             }\r\n        }\r\n    );\r\n}\r\n<\/pre>\n<h3>\u753b\u9762\u3067\u306e\u72b6\u614b\u306e\u78ba\u8a8d\u65b9\u6cd5<\/h3>\n<p>\u672c\u984c\u3068\u82e5\u5e72\u305d\u308c\u307e\u3059\u304c\u3001 HealthKit store \u3078\u306e\u66f8\u304d\u8fbc\u307f\u6642\u306e\u8a31\u53ef\u306e\u6709\u7121\u306f\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u30a2\u30d7\u30ea\u306e\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u30a2\u30af\u30bb\u30b9\u300d\u753b\u9762\u3067\u78ba\u8a8d\u30fb\u64cd\u4f5c\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b\u753b\u9762\u306e\u8868\u793a\u306e\u4ed5\u65b9 \u2192 <a href=\"https:\/\/support.apple.com\/ja-jp\/HT204351\" rel=\"noopener\" target=\"_blank\">Apple\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u30a2\u30af\u30bb\u30b9\u300d<\/a>\u306e\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3092\u8868\u793a\u3059\u308b\u300d<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/curecode.jp\/tech\/wp-content\/uploads\/2018\/02\/ScreenShot_2018-02-19_at_104504_edit4.png\" alt=\"\u30d8\u30eb\u30b9\u30b1\u30a2\u306e\u300c\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u30a2\u30af\u30bb\u30b9\u300d\u753b\u9762\" \/><\/p>\n<h3>IT\u30a8\u30f3\u30b8\u30cb\u30a2\u52df\u96c6\u4e2d\uff01<\/h3>\n<p>\u30ad\u30e5\u30a2\u30b3\u30fc\u30c9\u682a\u5f0f\u4f1a\u793e\u306fIT\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u52df\u96c6\u3057\u3066\u304a\u308a\u307e\u3059\u3002\u5c11\u4eba\u6570\u306e\u8077\u5834\u306a\u306e\u3067\u3001\u4e0a\u6d41\u30fb\u4e0b\u6d41\u3084\u30b5\u30fc\u30d0\u30fc\u30fb\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5bfe\u5fdc\u306e\u57a3\u6839\u306a\u304f\u3001\u3042\u306a\u305f\u306e\u5f37\u307f\u3092\u6d3b\u304b\u3057\u306a\u304c\u3089 \u3044\u308d\u3044\u308d\u306a\u3053\u3068\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u53ef\u80fd\u3067\u3059\u3002\u30a8\u30f3\u30b8\u30cb\u30a2\u3068\u3057\u3066\u306e\u672a\u7d4c\u9a13\u306e\u65b9\u3001\u7d4c\u9a13\u304c\u5c11\u306a\u3044\u65b9\u3082\u6b53\u8fce\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u3088\u308aIT\u30a8\u30f3\u30b8\u30cb\u30a2\u52df\u96c6\u306e\u63a1\u7528\u60c5\u5831\u3092\u3054\u89a7\u3044\u305f\u3060\u3051\u307e\u3059\u3002<\/p>\n<div class=\"curecode_recruit_bn\">\n\t\t\t\t<a href=\"https:\/\/curecode.jp\/recruit\/itengineer\/\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/curecode.jp\/tech\/wp-content\/themes\/tech\/images\/it_recruit.png?20241220\" alt=\"\u4e8b\u696d\u62e1\u5927\u306b\u4f34\u3044\u65b0\u3057\u3044\u9818\u57df\u306b\u4e00\u7dd2\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u304f\u30e1\u30f3\u30d0\u30fc\u3092\u52df\u96c6\u3057\u307e\u3059\u3002\"  width=\"500\" height=\"180\"\/><br \/>\n\t\t\t\t<\/a>\n\t\t<\/div>\n<h3>\u30ad\u30e5\u30a2\u30b3\u30fc\u30c9\u516c\u5f0f\u30a4\u30f3\u30b9\u30bf\u30b0\u30e9\u30e0<\/h3>\n<p>\u30ad\u30e5\u30a2\u30b3\u30fc\u30c9\u682a\u5f0f\u4f1a\u793e\u306e\u65b0\u30b5\u30fc\u30d3\u30b9\u60c5\u5831\u3084\u3001\u30aa\u30d5\u30a3\u30b9\u30e9\u30a4\u30d5\u306e\u7d20\u6575\u306a\u77ac\u9593\u307e\u3067\u3002\u79c1\u305f\u3061\u306e\u65e5\u3005\u306e\u55b6\u307f\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<div class=\"curecode_recruit_bn\">\n\t\t\t\t<a href=\"https:\/\/www.instagram.com\/curecode\/\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/curecode.jp\/tech\/wp-content\/themes\/tech\/images\/insta_bn.png?20241220\" alt=\"\u4e8b\u696d\u62e1\u5927\u306b\u4f34\u3044\u65b0\u3057\u3044\u9818\u57df\u306b\u4e00\u7dd2\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u304f\u30e1\u30f3\u30d0\u30fc\u3092\u52df\u96c6\u3057\u307e\u3059\u3002\"  width=\"500\" height=\"180\"\/><br \/>\n\t\t\t\t<\/a>\n\t\t<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u30a2\u30d7\u30ea\u3068\u9023\u643a\u3057\u305f\u3044 iPhone \u30a2\u30d7\u30ea\u300c\u30d8\u30eb\u30b9\u30b1\u30a2\u300d\u306f HealthKit stor [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":598,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[144,141],"tags":[145,149,148,146,147],"class_list":["post-1282","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","category-xamarin","tag-healthkit","tag-ios","tag-xamarin","tag-146","tag-147"],"_links":{"self":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts\/1282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/comments?post=1282"}],"version-history":[{"count":64,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts\/1282\/revisions"}],"predecessor-version":[{"id":1352,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts\/1282\/revisions\/1352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/media\/598"}],"wp:attachment":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/media?parent=1282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/categories?post=1282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/tags?post=1282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}