{ "id": "163246", "key": "TIMOB-23915", "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-02-08T11:25:31.000+0000", "created": "2016-09-16T09:05:33.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Hyperloop" ], "versions": [], "issuelinks": [ { "id": "54222", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "inwardIssue": { "id": "165830", "key": "TIMOB-24383", "fields": { "summary": "Hyperloop: iOS - Objects returned from NSArray/NSSet unusable", "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" } }, "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-03-24T18:35:47.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" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Trying to get lastPoint touched in screen return \r\n{code:java}\r\nJS exception encountered calling callback: undefined is not a function (evaluating 'UITouch.prototype.locationInView($.win)')\r\n{code}\r\n\r\ncode to reproduce: \r\n\r\nit assumes there is a win defined in xml. \r\n\r\n{code:java}\r\nvar UIView = require('UIKit/UIView');\r\nvar DrawView = Hyperloop.defineClass('DrawView', 'UIView');\r\n\r\nDrawView.addMethod({\r\n selector : 'touchesBegan:withEvent:',\r\n instance : true,\r\n arguments : ['NSSet', 'UIEvent'],\r\n callback : function(touches, event) {\r\n var touch = touches.anyObject();\r\n var lastPoint = touch.locationInView($.win);\r\n console.log(lastPoint);\r\n }\r\n});\r\n\r\nvar drawSurface = DrawView.alloc().initWithFrame(50, 0, 350, 350);\r\ndrawSurface.backgroundColor = UIColor.yellowColor();\r\n$.win.add(drawSurface);\r\n\r\n{code}", "attachment": [], "flagged": false, "summary": "Hyperloop - iOS: Touch event properties and methods are undefined", "creator": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Hyperloop: 1.2.7", "comment": { "comments": [ { "id": "396343", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "You are passing a Ti.UI.Window to a native API, that won't work:\r\n{code:javascript}\r\ntouch.locationInView($.win);\r\n{code}\r\nInstead, you may try to cast it to a UIView, using {{UIView.cast($.win)}}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-16T14:47:33.000+0000", "updated": "2016-09-16T14:47:33.000+0000" }, { "id": "396355", "author": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Same result with casting:\r\n\r\n\r\n{code:java}\r\nJS exception encountered calling callback: undefined is not a function (evaluating 'touch.locationInView(UIView.cast($.win))')\r\n{code}\r\n", "updateAuthor": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-16T16:18:06.000+0000", "updated": "2016-09-16T16:18:06.000+0000" }, { "id": "396393", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Then I guess {{touch}} is already null before. Try:\r\n{code:javascript}\r\nvar touch = touches.allObjects[0];\r\n{code}\r\ninstead.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-16T22:06:36.000+0000", "updated": "2016-09-16T22:06:36.000+0000" }, { "id": "396437", "author": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "body": "touch returns a valid object:\r\n\r\n\r\n{code}\r\n phase: Began tap count: 1 window: ; layer = > view: > location in window: {149.5, 225.5} previous location in window: {149.5, 225.5} location in view: {149.5, 225.5} previous location in view: {149.5, 225.5}\r\n{code}\r\n\r\nany way touches.allObjects[0]; returns null\r\n\r\n\r\n", "updateAuthor": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-17T13:33:04.000+0000", "updated": "2016-09-17T13:33:55.000+0000" }, { "id": "396441", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, so it's really only about the {{locationInView}} method then. I also noticed that the log of the object returns {{location in view: \\{149.5, 225.5\\}}} so at least something is there. I will move to TIMOB for further investigations.\r\n\r\nPlease also attach your generated metabase from {{build/hyperloop/ios}}, thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-17T15:10:54.000+0000", "updated": "2016-09-17T15:12:30.000+0000" }, { "id": "403214", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey Brian, out of interest: When you include a Foundation class (e.g. {{require('Foundation/NSURL')}}), does that fix the issue? It might be related to a different issue of the same type. Thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-12T21:25:07.000+0000", "updated": "2016-12-12T21:25:07.000+0000" }, { "id": "403263", "author": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans, \r\n\r\nI tried what you suggested but with no success, it still failling with the same error. \r\n\r\nI've just seen that you need the metabase, here is the gist (if you need a downloadable file let me know)[https://gist.github.com/Brianggalvez/1697f824da98bd1a6c002b848a79d49d]", "updateAuthor": { "name": "bgarcia", "key": "bgarcia", "displayName": "Brian García", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-13T12:11:32.000+0000", "updated": "2016-12-13T12:11:32.000+0000" }, { "id": "406562", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "I discovered a similar behavior when testing for TIMOB-24242. The {{NSSet}} will be populated with {{NSTouch}} objects on the native side. Somehow Hyperloop fails to properly wrap those objects when retrieving them from the {{NSSet}}, preventing any property access or method calls. I opened TIMOB-24383 to keep track of the root issue.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-02-08T02:56:41.000+0000", "updated": "2017-02-08T02:56:41.000+0000" }, { "id": "406572", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Resolving as {{Duplicate}} to keep track in the root-ticket. Thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-02-08T11:25:58.000+0000", "updated": "2017-02-08T11:25:58.000+0000" }, { "id": "415691", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the linked issues.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T18:35:47.000+0000", "updated": "2017-03-24T18:35:47.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }