{ "id": "172552", "key": "AC-6008", "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": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2019-01-16T11:31:42.000+0000", "created": "2018-11-05T10:11:39.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-01-16T11:31:42.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "15000", "name": "Hyperloop" }, { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Hi,\r\nI better open a new Issue, as I saw that the former issue was closed.\r\n\r\nI can write Samples to Apple HealthKit but have problems to read them back. Everything ist accepted until I want to execute the query.\r\nHope you can help.\r\n\r\nI tried building the query with 3 different methods (see in code):\r\nVersion 1 -> App starts but closed immediately. No error occurred\r\nVersion 3 -> the same. All debugs were shown\r\nFor version 2 I got:\r\n-[HKQuantityType activateWithClientQueue:healthStore:delegate:completion:]: unrecognized selector sent to instance 0x600000d6bd40\r\n[ERROR] : Script Error\r\n{ [ERROR] : column = 26; [ERROR] : description = \"-[HKQuantityType activateWithClientQueue:healthStore:delegate:completion:]: unrecognized selector sent to instance 0x600000d6bd40\"; [ERROR] : line = 133; [ERROR] : message = \"-[HKQuantityType activateWithClientQueue:healthStore:delegate:completion:]: unrecognized selector sent to instance 0x600000d6bd40\"; [ERROR] : name = NSInvalidArgumentException; [ERROR] : nativeStack = \"1 libobjc.A.dylib 0x000000010c390735 objc_exception_throw + 48\\n2 CoreFoundation 0x000000010d5a4f44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132\\n3 CoreFoundation 0x000000010d58aed6 ___forwarding___ + 1446\\n4 CoreFoundation 0x000000010d58cda8 _CF_forwarding_prep_0 + 120\\n5 HealthKit 0x000000010c007263 -[HKHealthStore executeQuery:activationHandler:] + 315\\n6 CoreFoundation 0x000000010d58d03c __invoking___ + 140\\n7 CoreFoundation 0x000000010d58a4d5 -[NSInvocation invoke] + 325\\n8 mcx alexa 0x00000001065d948e +[HyperloopUtils invokeSelector:args:target:instance:] + 1550\\n9 mcx alexa 0x00000001065ce141 Dispatch + 1489\\n10 JavaScriptCore 0x0000000106a85b9f _ZN3JSC19APICallbackFunction4callINS_18JSCallbackFunctionEEExPNS_9ExecStateE + 495\\n11 ??? 0x00003d75e6e0102d 0x0 + 67576593911853\\n12 JavaScriptCore 0x0000000106a5a33d llint_entry + 26817\\n13 JavaScriptCore 0x0000000106a5a33d llint_entry + 26817\\n14 JavaScriptCore 0x0000000106a5a33d llint_entry + 26817\\n15 JavaScriptCore 0x0000000106a538fe vmEntryToJavaScript + 244\\n16 JavaScriptCore 0x0000000106f4e36a _ZN3JSC11Interpreter14executeProgramERKNS_10SourceCodeEPNS_9ExecStateEPNS_8JSObjectE + 11178\\n17 JavaScriptCore 0x0000000107179a20 _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 288\\n18 JavaScriptCore 0x0000000106a84ff5 JSEvaluateScript + 501\\n19 mcx alexa 0x00000001062b8492 -[KrollBridge evalFileOnThread:context:] + 1314\\n20 mcx alexa 0x00000001062be3ec -[KrollInvocation invoke:] + 124\\n21 mcx alexa 0x00000001062bfa53 -[KrollContext invoke:] + 163\\n22 mcx alexa 0x00000001062bfe19 -[KrollContext invokeOnThread:method:withObject:callback:selector:] + 169\\n23 mcx alexa 0x00000001062b8614 -[KrollBridge evalFile:callback:selector:] + 116\\n24 mcx alexa 0x00000001062b94a8 -[KrollBridge didStartNewContext:] + 2600\\n25 mcx alexa 0x00000001062c070a -[KrollContext main] + 1834\\n26 mcx alexa 0x00000001062bf827 __21-[KrollContext start]_block_invoke + 39\\n27 libdispatch.dylib 0x000000010ea904e1 _dispatch_call_block_and_release + 12\\n28 libdispatch.dylib 0x000000010ea9154b _dispatch_client_callout + 8\\n29 libdispatch.dylib 0x000000010ea9d380 _dispatch_main_queue_callback_4CF + 1290\\n30 CoreFoundation 0x000000010d4eb3e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9\\n31 CoreFoundation 0x000000010d4e5a76 __CFRunLoopRun + 2342\\n32 CoreFoundation 0x000000010d4e4e11 CFRunLoopRunSpecific + 625\\n33 GraphicsServices 0x00000001128d51dd GSEventRunModal + 62\\n34 UIKitCore 0x0000000118d4581d UIApplicationMain + 140\\n35 mcx alexa 0x00000001062a4b86 main + 102\\n36 libdyld.dylib 0x000000010eb01575 start + 1\\n37 ??? 0x0000000000000001 0x0 + 1\"; [ERROR] : sourceURL = \"file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/E27FAF59-4BF6-462E-9BC9-9C3C390FC2A1/mcx%20alexa.app/hyperloop/healthkit/hkhealthstore.js\"; [ERROR] : stack = \" at dispatch@[native code]\\n at value@file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/E27FAF59-4BF6-462E-9BC9-9C3C390FC2A1/mcx%20alexa.app/hyperloop/healthkit/hkhealthstore.js:133:26)\\n at readParameterItem@file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/E27FAF59-4BF6-462E-9BC9-9C3C390FC2A1/mcx%20alexa.app/ui/common/app_ui_healthkit.js:241:47)\\n at global code@file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/E27FAF59-4BF6-462E-9BC9-9C3C390FC2A1/mcx%20alexa.app/app.js:231:29)\"; [ERROR] : }\r\nCode:\r\n//sampleType = HKSampleType.quantityTypeForIdentifier(HKQuantityTypeIdentifierDietaryEnergyConsumed)\r\nvar HKSampleType = require('HealthKit/HKSampleType');\r\nvar sampleType = HKSampleType.quantityTypeForIdentifier(require('HealthKit').HKQuantityTypeIdentifierBodyMass);\r\nepr.fct.iDebug(HKSampleType); epr.fct.iDebug(sampleType); epr.fct.iDebug(\"END SAMPLETYPE\");\r\n//let predicate = HKQuery.predicateForSamplesWithStartDate(startDate, endDate: endDate, options: .None)\r\nvar HKQuery = require('HealthKit/HKQuery');\r\nvar predicate = HKQuery.predicateForSamplesWithStartDateEndDateOptions(startDate, endDate, null);\r\nepr.fct.iDebug(predicate); epr.fct.iDebug(\"END PREDICAT\");\r\n//Sort\r\n//NSSortDescriptor *timeSortDescriptor = [[NSSortDescriptor alloc] initWithKey:HKSampleSortIdentifierEndDate ascending:NO];\r\nvar HKSort = require('Foundation/NSSortDescriptor');\r\nvar sortDesc = new HKSort(require('HealthKit').HKSampleSortIdentifierEndDate,true);\r\nepr.fct.iDebug(sortDesc); epr.fct.iDebug(\"END SORT\");\r\n//init(sampleType: HKSampleType,predicate: NSPredicate?,limit: Int,sortDescriptors: [NSSortDescriptor]?,resultsHandler: @escaping (HKSampleQuery, [HKSample]?, Error?) -> Void)\r\nvar HKSampleQuery = require('HealthKit/HKSampleQuery');\r\nepr.fct.iDebug(HKSampleQuery);\r\n//version 1\r\nvar query = HKSampleQuery.alloc().init(sampleType, predicate, require('HealthKit').HKObjectQueryNoLimit, sortDesc, fctResult);\r\n//version 2\r\n//var query = new HKSampleQuery(sampleType, predicate, require('HealthKit').HKObjectQueryNoLimit, sortDesc, fctResult);\r\n//version 3\r\n/*q = new HKSampleQuery();\r\nq.sampleType = sampleType;\r\nq.predicate = predicate;\r\nq.limit = require('HealthKit').HKObjectQueryNoLimit;\r\nq.sortDescriptors = sortDesc;\r\nq.resultsHandler = fctResult;\r\nepr.fct.iDebug(q);\r\nquery = q;*/\r\nepr.fct.iDebug(query); epr.fct.iDebug(\"END query\");\r\nvar ok = epr.hk.healthStore.executeQuery(query);\r\nepr.fct.iDebug(\"END EXECUTE\");", "attachment": [], "flagged": false, "summary": "error while writing data to Apple HealthKit", "creator": { "name": "mollin", "key": "mollin", "displayName": "Joachim Mollin", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mollin", "key": "mollin", "displayName": "Joachim Mollin", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "443279", "author": { "name": "mollin", "key": "mollin", "displayName": "Joachim Mollin", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This error is shown in the Simulator\r\n/hkhealthstore.js:133\r\nvar result = $dispatch(this.$native, 'executeQuery:', [_query], true);\r\n^\r\n-[HKQuantityType activateWithClientQueue:healthStore:delegate:completion:]: unrecognized selector sent to instance 0x6000031760d0\r\nat dispatch@[native code]\r\nat value@file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/13AC1432-F4BC-4508-A72F-1FAC5A7CE127/mcx%20alexa.app/hyperloop/healthkit/hkhealthstore.js:133:26)\r\nat readParameterItem@file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/13AC1432-F4BC-4508-A72F-1FAC5A7CE127/mcx%20alexa.app/ui/common/app_ui_healthkit.js:241:47)\r\nat global code@file:///Users/mollin/Library/Developer/CoreSimulator/Devices/80119195-156D-4879-8609-9CE5FDD6FF33/data/Containers/Bundle/Application/13AC1432-F4BC-4508-A72F-1FAC5A7CE127/mcx%20alexa.app/app.js:231:29)\r\n4 mcx alexa 0x000000010c9b13ec -[KrollInvocation invoke:] + 124\r\n5 mcx alexa 0x000000010c9b2a53 -[KrollContext invoke:] + 163\r\n6 mcx alexa 0x000000010c9b2e19 -[KrollContext invokeOnThread:method:withObject:callback:selector:] + 169\r\n7 mcx alexa 0x000000010c9ab614 -[KrollBridge evalFile:callback:selector:] + 116\r\n8 mcx alexa 0x000000010c9ac4a8 -[KrollBridge didStartNewContext:] + 2600\r\n9 mcx alexa 0x000000010c9b370a -[KrollContext main] + 1834\r\n10 mcx alexa 0x000000010c9b2827 __21-[KrollContext start]_block_invoke + 39\r\n11 libdispatch.dylib 0x000000011509e4e1 _dispatch_call_block_and_release + 12\r\n12 libdispatch.dylib 0x000000011509f54b _dispatch_client_callout + 8\r\n13 libdispatch.dylib 0x00000001150ab380 _dispatch_main_queue_callback_4CF + 1290\r\n14 CoreFoundation 0x0000000113aef3e9 _CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE_ + 9\r\n15 CoreFoundation 0x0000000113ae9a76 __CFRunLoopRun + 2342\r\n16 CoreFoundation 0x0000000113ae8e11 CFRunLoopRunSpecific + 625\r\n17 GraphicsServices0x0000000118ee31dd GSEventRunModal + 62\r\n18 UIKitCore 0x000000011f43d81d UIApplicationMain + 140\r\n19 mcx alexa 0x000000010c997b86 main + 102", "updateAuthor": { "name": "mollin", "key": "mollin", "displayName": "Joachim Mollin", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-05T10:13:40.000+0000", "updated": "2018-11-05T10:13:40.000+0000" }, { "id": "444067", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Please provide a standalone sample code that can be used to reproduce the issue. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2018-11-29T23:39:19.000+0000", "updated": "2018-11-29T23:39:19.000+0000" }, { "id": "444397", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\nJust passing as update here.Are you able to get that sorted out?  Please let us know if you need more help with this issue.\r\n", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-12-10T10:28:24.000+0000", "updated": "2018-12-10T10:28:24.000+0000" }, { "id": "444910", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\nWe have not heard back from you since our last update.I just wanted to follow up with you about this issue? Are you still experiencing this problem?\r\nPlease let us know if you need more help with this issue.\r\n\r\nThanks\r\n", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-01-02T09:53:35.000+0000", "updated": "2019-01-02T09:53:35.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }