{ "id": "174603", "key": "AC-6465", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": null, "resolutiondate": null, "created": "2020-01-01T21:36:07.000+0000", "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-29T20:24:31.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "15000", "name": "Hyperloop" }, { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I'm trying to authorize HealthKit via Hyperloop to query height of the user, so I run the following code:\r\n\r\n{code}\r\nimport {\r\n HKHealthStore,\r\n} from 'HealthKit';\r\n\r\nif (HKHealthStore.isHealthDataAvailable()) {\r\n Ti.API.log('available');\r\n} else {\r\n Ti.API.log('not available');\r\n}\r\n\r\nlet hk = new HKHealthStore();\r\nhk.requestAuthorizationToShareTypes([], [], function() {});\r\n{code}\r\n\r\nIt does show \"available\" message, so I assume that heath data is available, but then it throughs an error \"hk.requestAuthorizationToShareTypes is not a function\", I've tried \"swift-like\" function \"requestAuthorization\" as well, but same result.\r\n\r\np.s. Is there any way to get available functions from Hyperloop?", "attachment": [], "flagged": false, "summary": "Hyperloop - HealthKit requestAuthorizationToShareTypes is not a function", "creator": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "subtasks": [], "reporter": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "environment": "Operating System\r\nName = Mac OS X\r\nVersion = 10.15.2\r\nArchitecture = 64bit\r\n# CPUs = 4\r\nMemory = 8589934592\r\nNode.js\r\nNode.js Version = 8.9.3\r\nnpm Version = 6.8.0\r\nTitanium CLI\r\nCLI Version = 5.2.2\r\nTitanium SDK\r\nSDK Version = 8.3.0.GA\r\nTarget Platform = iphone", "comment": { "comments": [ { "id": "453434", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "I guess you are trying to use [requestAuthorizationToShareTypes:readTypes:completion:|https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorizationtosharetypes?language=objc].\r\n\r\nAccording to the conventions for [method names|https://docs.appcelerator.com/platform/latest/#!/guide/iOS_Hyperloop_Programming_Guide-section-src-46253491_iOSHyperloopProgrammingGuide-Namedmethods], this is the Hyperloop equivalent:\r\n\r\n{code}\r\nhk.requestAuthorizationToShareTypesReadTypesCompletion([], [], function() {});\r\n{code}", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-01-06T12:18:29.000+0000", "updated": "2020-01-06T12:18:29.000+0000" }, { "id": "453448", "author": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "body": "Yes, that's true. It was my mistake that I missed this part of the iOS Hyperloop Programming Guide.\r\n\r\nBut now, after I follow your suggestion it doesn't seem to do anything. No error, no authorization popup.\r\n\r\n{code}\r\nlet hk = new HKHealthStore();\r\nlet height = HKObjectType.quantityTypeForIdentifier('HKQuantityTypeIdentifierHeight');\r\nhk.requestAuthorizationToShareTypesReadTypesCompletion([height], [height], function completion(success, error) {\r\n Ti.API.log('success');\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "created": "2020-01-06T20:12:33.000+0000", "updated": "2020-01-06T20:12:33.000+0000" }, { "id": "453465", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~pmalakhaltsev] have you configured the correct plist keys? Like NSHealthShareUsageDescription and NSHealthUpdateUsageDescription?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-01-07T14:22:11.000+0000", "updated": "2020-01-07T14:22:11.000+0000" }, { "id": "453477", "author": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "body": "Yes, I have both keys in tiapp.xml\r\n{code}\r\n NSHealthShareUsageDescription\r\n Share data description\r\n NSHealthUpdateUsageDescription\r\n Access data description\r\n{code}\r\n\r\nAlso I have \"entitlements\" section:\r\n{code}\r\n \r\n \r\n com.apple.developer.healthkit\r\n \r\n com.apple.developer.healthkit.access\r\n \r\n \r\n \r\n{code}\r\n\r\nBesides this I've tried to clean the project and rebuild it. Doesn't help.\r\n\r\n", "updateAuthor": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "created": "2020-01-07T17:58:39.000+0000", "updated": "2020-01-07T17:58:39.000+0000" }, { "id": "453840", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~pmalakhaltsev] perhaps you have the same issue as [this guy?|https://stackoverflow.com/questions/26010554/requestauthorizationtosharetypes-method-not-displaying-permissions-prompt-in-ios] ", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-01-28T10:14:58.000+0000", "updated": "2020-01-28T10:14:58.000+0000" }, { "id": "453885", "author": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "body": "@topener, that's unlikely as:\r\n1. I pass not a string but (hopefully) quanityType\r\n{code:javascript}\r\nvar height = HKObjectType.quantityTypeForIdentifier(\"HKQuantityTypeIdentifierHeight\");\r\n{code}\r\n2. I initialize healthStore as an object (according to Hyperloop guide):\r\n{code:javascript}\r\nvar hk = HKHealthStore.alloc().init();\r\n// or\r\nvar hk = new HKHealthStore();\r\n{code}\r\nSo I can't spot any visible mistake in the code ..\r\n", "updateAuthor": { "name": "pmalakhaltsev", "key": "pmalakhaltsev", "displayName": "Petr Malakhaltsev", "active": true, "timeZone": "Europe/Budapest" }, "created": "2020-01-29T20:24:31.000+0000", "updated": "2020-01-29T20:24:31.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }