[TIMOB-27054] iOS: Ti.API.log() function no longer works within WebView's HTML JS code as of 8.0.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-06-04T21:43:44.000+0000 |
Affected Version/s | Release 8.0.0 |
Fix Version/s | Release 8.0.2 |
Components | iOS |
Labels | WebView, engSchedule, html, ios, log, regression |
Reporter | Joshua Quick |
Assignee | Vijay Singh |
Created | 2019-05-02T17:40:59.000+0000 |
Updated | 2019-06-04T21:43:44.000+0000 |
Description
*Summary:*
The [Ti.API.log()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.API-method-log) function no longer works within a
WebView
's HTML <script/>
code as of Titanium 8.0.0.
*Steps to reproduce:*
Set up a Classic Titanium "app.js" with the below code.
Build and run on iOS with Titanium 8.0.0 or 8.0.1.
Notice that *none* of the below messages get logged.
Build and run with Titanium 7.x.x.
Notice that the below message do get logged.
var htmlText =
'<!DOCTYPE html>\n' +
'<html>\n' +
' <head>\n' +
' <meta name="viewport" content="width=device-width, initial-scale=1.0">\n' +
' </head>\n' +
' <body>\n' +
' <p>HTML JavaScript Logging Test</p>\n' +
' </body>\n' +
' <script>\n' +
' document.addEventListener("DOMContentLoaded", function(e) {\n' +
' Ti.API.log("info", "@@@ Logging via Ti.API.log(info,message) method.");\n' +
' Ti.API.log("warn", "@@@ Logging via Ti.API.log(warn,message) method.");\n' +
' Ti.API.log("error", "@@@ Logging via Ti.API.log(error,message) method.");\n' +
' });\n' +
' </script>\n' +
'</html>\n';
var window = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({
html: htmlText,
});
window.add(webView);
window.open();
*Work-Around:*
Use the following instead. They work in 8.0.x and older versions.
Ti.API.info("My info.");
Ti.API.warn("My warning.");
Ti.API.error("My error");
PR(Master) - https://github.com/appcelerator/titanium_mobile/pull/10877 Note- Above PR is same as of ticket TIMOB-27055. Fixed both issue in same ticket in master. PR(8_0_X) - https://github.com/appcelerator/titanium_mobile/pull/10922
FR Passed. Waiting on Jenkins
Waiting for resolving jenkin's failure to merge
merged to master, 8_0_X, 8_1_X
Verified the fix on SDK 8.2.0.v20190603133455, SDK 8.1.0.v20190603133458 and SDK 8.0.2.v20190603133031. Ti.API.log() logged in the console correctly.Closing