{ "id": "169162", "key": "TIMOB-25034", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2017-11-15T14:11:28.000+0000", "created": "2017-07-28T08:17:32.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "CLBeacon", "NSArray", "hyperloop" ], "versions": [], "issuelinks": [ { "id": "55715", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "169417", "key": "TIMOB-25069", "fields": { "summary": "Hyperloop: iOS - Inheritance issues when casting objects", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-11-15T14:11:28.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": "13715", "name": "Hyperloop", "description": "Hyperloop project" } ], "attachment": [], "flagged": false, "summary": "Hyperloop: Properties from object in NSArray are undefined", "creator": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "subtasks": [], "reporter": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.12.3\r\n Architecture = 64bit\r\n # CPUs = 8\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 4.6.0\r\n npm Version = 2.15.9\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\nTitanium SDK\r\n SDK Version = 6.1.1.GA\r\n\r\nHyperloop v. 2.1.2", "comment": { "comments": [ { "id": "425014", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey there, thank for the fixes, this is great! Can you open a Pull Request on the repository, so we can merge your changes? That's how it stays your contribution. If not interested, we can also schedule to make the change ourselves. Thanks again!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-07-28T13:18:37.000+0000", "updated": "2017-07-28T13:18:37.000+0000" }, { "id": "425024", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~sandrolain], can you please try to change the following:\r\n\r\n{code}\r\nvar beacon = beacons.objectAtIndex(i);\r\n{code}\r\nto\r\n{code}\r\nvar beacon = CLBeacon.cast(beacons.objectAtIndex(i));\r\n{code}\r\n\r\nObjects from arrays are always returned wrapped as an {{NSObject}} by default and you need to explicitly cast them to the actual type you want to access methods and properties from.\r\n\r\n[~hknoechel], we should maybe consider printing the JS prototype name alongside the native wrapped object for clearer log outputs. I also added this to TIDOC-2811 so it will be properly documented.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-07-28T14:56:43.000+0000", "updated": "2017-07-28T14:56:43.000+0000" }, { "id": "425056", "author": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "body": "*Thank you!* I tried to convert objects and now the properties are visible.\r\nAt first it seemed not to work. I was using Hyperloop with Liveview enabled, and it seems that some changes to the code are not up to date on the device. I do not know if it was a problem only to my running, but sometimes I still had to recompile the app to learn the changes even though I saw the app to refresh.", "updateAuthor": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "created": "2017-07-30T08:52:33.000+0000", "updated": "2017-07-30T08:52:33.000+0000" }, { "id": "425982", "author": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "body": "I've encountered another problem getting access to the properties of Hyperloop instances.\r\n\r\nI'm developing an application that uses Core Bluetooth in iOS.\r\n\r\nWhen I look for information about services (instance of CBService) of a peripheral sometimes the value of \"UUID\" property is \"undefined\".\r\nIf I try to get the same property by casting it to the type from which it is derived (CBAttribute) I can read the popriety correctly.\r\n\r\nApple references:\r\nhttps://developer.apple.com/documentation/corebluetooth/cbservice?language=objc\r\nhttps://developer.apple.com/documentation/corebluetooth/cbattribute?language=objc\r\nhttps://developer.apple.com/documentation/corebluetooth/cbperipheral?language=objc\r\n\r\nServices are read after the invocation of:\r\nhttps://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate/1518744-peripheral?language=objc\r\n\r\nAfter the call to:\r\nhttps://developer.apple.com/documentation/corebluetooth/cbperipheral/1518706-discoverservices?language=objc\r\n\r\n\r\nWhat's strange is that the \"isPrimary\" property of the CBService instance becomes \"undefined\" after I ran the second cast at CBAttribute, before cast it was valued!\r\n\r\nReport the part of the code involved (I can not return all the code because it is too large and involves the work for one of my clients):\r\n\r\n\r\n{code:java}\r\n\r\nfor(var i = 0, len = peripheral.services.count; i < len; i++)\r\n{\r\n\tvar service = CBService.cast(peripheral.services.objectAtIndex(i));\r\n\t\r\n\tconsole.log(\"CBService.UUID: \" + service.UUID);\r\n\tconsole.log(\"CBService.isPrimary: \" + service.isPrimary);\r\n\t\r\n\tvar attr = CBAttribute.cast(peripheral.services.objectAtIndex(i));\r\n\t\r\n\tconsole.log(\"CBAttribute.UUID: \" + attr.UUID);\r\n\tconsole.log(\"CBService.isPrimary: \" + service.isPrimary);\r\n}\r\n\r\n{code}\r\n\r\n\r\nThe console log:\r\n\r\n{noformat}\r\n[INFO] : CBService.UUID: undefined\r\n[INFO] : CBService.isPrimary: 1\r\n[INFO] : CBAttribute.UUID: Device Information\r\n[INFO] : CBService.isPrimary: undefined\r\n[INFO] : CBService.UUID: Battery\r\n[INFO] : CBService.isPrimary: 1\r\n[INFO] : CBAttribute.UUID: Battery\r\n[INFO] : CBService.isPrimary: undefined\r\n{noformat}\r\n\r\nSimilarly after calling \"peripheral:didDiscoverCharacteristicsForService:error:\"\r\nI should have the \"characteristics\" (NSArray) property of the CBService instance valued but I get as a value.\r\n\r\nhttps://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate/1518821-peripheral?language=objc\r\nhttps://developer.apple.com/documentation/corebluetooth/cbservice/1434319-characteristics?language=objc\r\n\r\n\r\n{code:java}\r\n\r\nconsole.log(service.characteristics);\r\n\r\nfor(var i = 0, len = service.characteristics.count; i < len; i++)\r\n{\r\n\tvar characteristic = CBCharacteristic.cast(service.characteristics.objectAtIndex(i));\r\n\t\r\n\tconsole.log(characteristic);\r\n}\r\n\r\nconsole.log(\"Code not executed\");\r\n{code}\r\n\r\n\r\n{noformat}\r\n[INFO] : \r\n{noformat}\r\n\r\n\r\nI also do not know if it is a problem with my Titanium Studio / Hyperloop installation but when there are errors in the Hyperloop code call, as for example, accessing unvaluated properties as if they were, the code is terminated but in the Titanium Console I have no report of error in the studio, and this takes a long time to waste.\r\n", "updateAuthor": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "created": "2017-08-05T12:45:45.000+0000", "updated": "2017-08-05T13:00:02.000+0000" }, { "id": "426007", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~sandrolain], thanks for all your input. I created TIMOB-25069 based on your findings and will further investigate the issue you are seeing there.\r\n\r\nCan you please create a new ticket for the other issue you are experiencing with unreported exceptions and create a minimal working example so we can reproduce it? Thanks a lot!", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-08-07T16:56:20.000+0000", "updated": "2017-08-07T16:56:20.000+0000" }, { "id": "430711", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "Closing as a duplicate of TIMOB-25069 which covers the root issue of this ticket with an easier to reproduce example that is not tied to Bluetooth.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-15T14:11:28.000+0000", "updated": "2017-11-15T14:11:28.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }