Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5524] Hyperloop NSData question

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNot Our Bug
Resolution Date2018-01-17T08:41:13.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsHyperloop
Labelsn/a
ReporterMichael Hay
AssigneeShak Hossain
Created2018-01-16T19:47:14.000+0000
Updated2018-01-17T08:41:14.000+0000

Description

The latest intecom module in hyperloop produces this configurations. I cant sent a string to it as its as it seems to require and NS data object and i'm sensing a String. Can i convert it? Trying: {{TiIntercom.setDeviceToken('f4cf7dd07dac7a35d6f8479129d9cb05e4dc6a3a087640025121d6dcd76dc8df'); }} Error: {{: [ERROR] -[__NSCFString bytes]: unrecognized selector sent to instance 0x1c80ad1a0 : [ERROR] TiIntercom ex: {"line":147,"column":26,"sourceURL":"file:///var/containers/Bundle/Application/E070E5ED-B942-4574-8FB1-B490282A1A82/Buildcloud.app/hyperloop/intercom/intercom.js","description":"-[__NSCFString bytes]: unrecognized selector sent to instance 0x1c80ad1a0","name":"NSInvalidArgumentException","nativeStack":"1 libobjc.A.dylib 0x0000000180580528 objc_exception_throw + 56\134n2 CoreFoundation 0x0000000181347828 + 0\134n3 CoreFoundation 0x000000018133fd10 + 1380\134n4 CoreFoundation 0x0000000181224ecc _CF_forwarding_prep_0 + 92\134n5 Buildcloud 0x0000000100399874 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 607308\134n6 Buildcloud 0x000000010039993c _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 607508\134n7 Buildcloud <\M-b\M^@\M-&> }} Form Hyperloop JSON: {{"setDeviceToken:": { "arguments": [ { "encoding": "@", "name": "deviceToken", "type": "objc_pointer", *"value": "NSData *"* } ], "encoding": "v24@0:8@16", "instance": false, "name": "setDeviceToken", "returns": { "encoding": "v", "type": "void", "value": "void" }, "selector": "setDeviceToken:" },}}

Comments

  1. Sharif AbuDarda 2018-01-17

    Hello [~hknoechel], please can you help here?!
  2. Hans Knöchel 2018-01-17

    You need to pass it as NSData, noch as a String, which is no Hyperloop related task but a general native programming one. [Here](https://stackoverflow.com/a/26346543) is an example of converting it from Swift - should be adoptable by Hyperloop. The other way would be to actually subscribe to the native application: didRegisterForRemoteNotificationsWithDeviceToken: selector that can be accessed from Hyperloop and native modules starting in 7.1.0 and later.

JSON Source