{ "id": "153275", "key": "TIMOB-20018", "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": [ { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-11-23T20:11:17.000+0000", "created": "2015-11-18T17:03:53.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "webview" ], "versions": [ { "id": "16904", "description": "Release 5.0.2", "name": "Release 5.0.2", "archived": true, "released": true, "releaseDate": "2015-10-01" } ], "issuelinks": [ { "id": "50315", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "154321", "key": "TIMOB-20254", "fields": { "summary": "How to detect click in Highcharts and trigger event in application?", "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": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-01-19T21:45:40.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "The example from your site that I am trying to run is not functioning in IOS 9.1. I am interested in getting the event fired from the WebView to be caught in the application. This works in Android but not in IOS. I have tried it WillHandleTouches set to False.\r\n\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\t\r\n\t\t\r\n\t\r\n\r\n\r\nvar win = Ti.UI.createWindow();\r\nvar webview = Ti.UI.createWebView({\r\n\turl: 'logging.html'\r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'fromTitanium',\r\n\theight: '50dp',\r\n\twidth: '130dp'\r\n});\r\nbutton.addEventListener('click', function(e) {\r\n\tTi.App.fireEvent('app:fromTitanium', { message: 'event fired from Titanium, handled in WebView' });\r\n});\r\nTi.App.addEventListener('app:fromWebView', function(e) {\r\n\talert(e.message);\r\n});\r\nwin.add(webview);\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: Ti.App.fireEvent from webView is not working", "creator": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "subtasks": [], "reporter": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "environment": "dev platform is MAC El Capitan\r\nIOS 9.1\r\nSDK version 5.0.2", "closedSprints": [ { "id": 529, "state": "closed", "name": "2015 Sprint 24 SDK", "startDate": "2015-11-21T01:30:12.670Z", "endDate": "2015-12-05T01:30:00.000Z", "completeDate": "2015-12-07T03:57:17.094Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "370965", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "This is seemingly a deadlock issue between the JS execution thread and main queue. For a quick work around, just delay the alert in JS so that main queue is not blocked. Change html to \r\n\r\n{code}\r\n\r\n\r\n\t\r\n\r\n\r\n\t\r\n\t\r\n\r\n{code}\r\n\r\nIn course we will fix this issue. ", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-11-20T07:56:41.000+0000", "updated": "2015-11-20T07:56:41.000+0000" }, { "id": "370967", "author": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/7477\r\nTested with reported test case html.", "updateAuthor": { "name": "ssombhatla", "key": "ssombhatla", "displayName": "Srikanth Sombhatla", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-11-20T08:24:56.000+0000", "updated": "2015-11-20T08:24:56.000+0000" }, { "id": "371022", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "The solution given seems to be for message from the App to WebView, My issue is the other way around from the WebView to the app. can you please see if there is a work around for that.", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-20T19:21:23.000+0000", "updated": "2015-11-20T19:21:23.000+0000" }, { "id": "371149", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "May I get an update on this issue please? we will really appreciate an fix or workaround for this issue?", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-23T14:40:10.000+0000", "updated": "2015-11-23T14:40:10.000+0000" }, { "id": "371219", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi [~rramesh1], the issues was just resolved as part of the 5.2.0 release. Using the fix, your test case works from both webview -> app and app -> webview.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-23T20:12:36.000+0000", "updated": "2015-11-23T20:12:36.000+0000" }, { "id": "371220", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "when will this be released? May I get a preview version so that we can begin testing our app.", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-23T20:16:28.000+0000", "updated": "2015-11-23T21:25:27.000+0000" }, { "id": "371230", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi [~rramesh1], the release is planned for next year, as we just released 5.1.0.GA last week. But: You can always grab the latest preview version. [Here|http://builds.appcelerator.com/mobile/master/mobilesdk-5.2.0.v20151123122025-osx.zip] is the latest 5.2.0 build including the fix, we hope that helps!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-23T21:28:19.000+0000", "updated": "2015-11-23T21:28:19.000+0000" }, { "id": "371603", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "I will try it out, If I run into trouble with 5.2.0 may I get a patch on 5.1.1 please", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-29T01:02:28.000+0000", "updated": "2015-11-29T01:02:28.000+0000" }, { "id": "371604", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Since it is no 5.1.0 related issue and 5.1.1 is already out, you will need to wait until 5.2.0 releases. But you can always patch your own version by following [this|http://docs.appcelerator.com/platform/latest/#!/guide/Building_the_Titanium_SDK_From_Source] instructions.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-29T01:10:47.000+0000", "updated": "2015-11-29T01:10:47.000+0000" }, { "id": "371605", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "I used the 5.2.0 you gave and tested the message, from the webview-> app did not work. here is code that I used. \r\n\r\n\r\nvar html = '' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t\t'' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t\t\"\" +\r\n\t\t\t\t\t''+\r\n\t\t\t\t'' ;\r\n\t\t\r\nvar win = Ti.UI.createWindow();\r\nvar webview = Ti.UI.createWebView({\r\n\thtml:html,\r\n\ttop :50,\r\n\twillHandleTouches:false\r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'fromTitanium',\r\n\theight: '50dp',\r\n\twidth: '130dp'\r\n});\r\nbutton.addEventListener('click', function(e) {\r\n\tTi.App.fireEvent('app:fromTitanium', { message: 'event fired from Titanium, handled in WebView' });\r\n});\r\nTi.App.addEventListener('app:fromWebView', function(e) {\r\n\talert(e.message);\r\n});\r\nwin.add(webview);\r\nwin.add(button);\r\nwin.open();", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-29T03:50:03.000+0000", "updated": "2015-11-29T03:55:19.000+0000" }, { "id": "371622", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "Just want to clarify that this is an issue only in IOS", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-30T02:58:46.000+0000", "updated": "2015-11-30T02:58:46.000+0000" }, { "id": "371624", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "You are trying to embed a multiline html file inline, for which the property is not intended. Please try the fix in the scenario you stated in the original ticket description where you load the html using a local file.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-30T03:10:24.000+0000", "updated": "2015-11-30T03:10:24.000+0000" }, { "id": "371656", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "I will change it to local file and test it later today", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-11-30T16:31:50.000+0000", "updated": "2015-11-30T16:31:50.000+0000" }, { "id": "371718", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "\r\nvar html = '' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t\t'' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t\t\"\" +\r\n\t\t\t\t\t''+\r\n\t\t\t\t'' ;\r\n\tvar htmlFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, \"drive.html\");\t\t\t\r\n\thtmlFile.write(html);\r\n\t\t\r\nvar win = Ti.UI.createWindow();\r\nvar webview = Ti.UI.createWebView({\r\n\t//url:\"https://saveonroad.com/test.html\",\r\n\turl: htmlFile.getNativePath(),\r\n\t//html:html,\r\n\ttop :50,\r\n\twillHandleTouches:false\r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttitle: 'fromTitanium',\r\n\theight: '50dp',\r\n\twidth: '130dp'\r\n});\r\nbutton.addEventListener('click', function(e) {\r\n\tTi.App.fireEvent('app:fromTitanium', { message: 'event fired from Titanium, handled in WebView' });\r\n});\r\nTi.App.addEventListener('app:fromWebView', function(e) {\r\n\talert(e.message);\r\n});\r\nwin.add(webview);\r\nwin.add(button);\r\nwin.open();", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-12-01T01:43:06.000+0000", "updated": "2015-12-01T01:43:06.000+0000" }, { "id": "371720", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "tried these three scenarios , in none of the cases message from webview to App did not work. when the file is local or when using html string, app to webview message worked. When the file is remote messaging between the webview and the app did not work in both directions.", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-12-01T01:46:16.000+0000", "updated": "2015-12-01T15:35:54.000+0000" }, { "id": "371723", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "It works in one scenario, where the file exists on the local device, this file has to be static and we should not write to the file before opening it in the webview", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-12-01T01:54:18.000+0000", "updated": "2015-12-01T15:35:25.000+0000" }, { "id": "371785", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi [~rramesh1], to clarify this once again: Sending and receiving events from the webview is *only* supposed to work with local html files. For example, your multi line inline had several syntax errors that prevented it from working. Please a) cache the html and display it or b) use a local html file from the beginning (recommended). If you still have issues, please check the [docs|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView] or the [Q&A|https://developer.appcelerator.com/questions/newest]", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-12-01T15:41:21.000+0000", "updated": "2015-12-01T15:41:21.000+0000" }, { "id": "371863", "author": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "body": "thanks Hans for your assistance it works now. ", "updateAuthor": { "name": "rramesh1", "key": "rramesh1", "displayName": "Ramesh RAMAMURTHY", "active": true, "timeZone": "America/Denver" }, "created": "2015-12-02T04:34:47.000+0000", "updated": "2015-12-02T04:34:47.000+0000" }, { "id": "374867", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed. Verified that while using the sample code from the bug description and a local html file (as per Hans's comment), I was able to fire an event from the app to WebView and vice-versa.\r\n\r\nTested on:\r\n\r\nAppc CLI NPM: 4.2.2\r\nAppc CLI Core: 5.2.0-229\r\nArrow: 1.7.21\r\nSDK: 5.2.0.v20160114021251\r\nNode: v4.2.4\r\nOS: El Capitan (10.11.2)\r\nXcode: 7.2\r\nDevices: iphone 6 (9.2)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-01-19T21:45:22.000+0000", "updated": "2016-01-19T21:45:22.000+0000" } ], "maxResults": 21, "total": 21, "startAt": 0 } } }