{ "id": "175266", "key": "AC-6568", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": null, "resolutiondate": null, "created": "2020-07-07T12:40:57.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-07-21T08:01:56.000+0000", "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" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "*Summary*\r\n\r\nI'm downloading some images from the internet and storing them in the Ti.Filesystem.applicationDataDirectory. Since WKWebView was introduced we can no longer access the application directory directly, but I thought we could work around this by setting the baseURL in the second parameter of WebView.setHTML.\r\n\r\n*Step to reproduce*\r\n\r\n# Add the example code to a Titanium classic project\r\n# Set the SDK to 9.0.3.GA\r\n# Run the app on iOS and wait for the webview to load (black content)\r\n\r\n{code:java}\r\nconst window = Ti.UI.createWindow();\r\nconst wv = Ti.UI.createWebView();\r\nwindow.add(wv);\r\n\r\nfunction getContentDir() {\r\n var dir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'content/');\r\n if (!dir.exists()) {\r\n dir.createDirectory();\r\n }\r\n return dir;\r\n}\r\n\r\nfunction getImage() {\r\n const contentDir = getContentDir();\r\n return Ti.Filesystem.getFile(contentDir.nativePath, 'image.png');\r\n}\r\n\r\nfunction request() {\r\n return new Promise(function (resolve, reject) {\r\n const req = Ti.Network.createHTTPClient({\r\n onload: () => {\r\n resolve(req.responseData);\r\n },\r\n onerror: (error) => {\r\n reject(error);\r\n },\r\n timeout: 15000\r\n });\r\n\r\n req.open(\"GET\", \"https://www.appcelerator.com/wp-content/uploads/Axway_logo_horiz_clr_rev_rgb.png\");\r\n req.send(null);\r\n });\r\n}\r\n\r\nfunction getWrappedHTML(bodyContent) {\r\n return `\r\n \r\n
\r\n \r\n \r\n \r\n \r\n