{ "id": "137049", "key": "AC-1602", "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": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2014-09-23T23:02:32.000+0000", "created": "2014-09-23T19:21:42.000+0000", "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "sscott", "key": "sscott", "displayName": "Steven Scott", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:38:04.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "QA Thread: http://developer.appcelerator.com/question/177846/ios8---filesystem-changes-applicationdatadirectory-vs-webview\r\n\r\nmy app used to work like this (up to iOS7):\r\n\r\na webview is loading a local webpage. Some json files are copied to applicationDataDirectory and if the user makes an \"internal update\" newer files get pulled from the internet into the applicationDataDirectory. The webview now opens the json files from there to have the newest files. For this I've just added '../Documents' in front of the files (inside the webpage local js files). That was working fine. But in iOS8 it looks like the content is in two seperate folders now:\r\n\r\nwebview:\r\n{code}\r\n../Library/Developer/CoreSimulator/Devices/30.../data/Containers/Bundle/Application/E83.../Documents/file.json\r\n{code}\r\n\r\napplicationDataDirectory: \r\n{code}\r\n../Library/Developer/CoreSimulator/Devices/30.../data/Containers/Data/Application/F97../Documents/file.json\r\n{code}\r\n\r\nnotice that it is now \"Data\" instead of \"Bundle\" and even a different ID. So how can I get from the webview folder to the writeable folder now?\r\n\r\nEven if I copy a index.html to applicationDataDirectory and try to set the webview url to that file it won't open.\r\n\r\nPassing the applicationDataDirectory into the webview page and setting the filepath via javascript won't load the file\r\n\r\nSome more infos about the problem:\r\nApple Doc: https://developer.apple.com/library/ios/technotes/tn2406/_index.html\r\nTech Republica: http://www.techrepublic.com/article/why-ios-8-could-break-your-hybrid-mobile-app/\r\nStackoverflow Thread: http://stackoverflow.com/questions/25794747/xcode-6-ios-8-simulator-data-and-bundle-folder-script\r\nBlog post: http://hetzel.net/2014-09-18/ios-8-folder-structure/", "attachment": [], "flagged": false, "summary": "iOS8: WebView not able to access files in applicationDataDirectory anymore", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": "iOS8\r\nTitanium 3.4.0 RC\r\nOSX", "comment": { "comments": [ { "id": "325299", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "h6. Can't reproduce\r\nCan't reproduce this issue.\r\nSee below for code used to try to reproduce this issue. If this issue persists, please provide example code that we can use to reproduce the issue.\r\n\r\n*Steps to followed*\r\n1. Create the 4 files below in the `Resources` directory of your app\r\n2. Launch the app and click `load` (see a blue background...the css loaded)\r\n3. Click the `Click Me!` button (see an alert dialog...the js file loaded)\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#FFF'\r\n});\r\nwin.open();\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle: \"load\",\r\n\ttop: 20,\r\n\theight: 50\r\n});\r\nwin.add(button);\r\nbutton.addEventListener('click', function() {\r\n\tcopyFileToAppData('test.css');\r\n\tcopyFileToAppData('test.js');\r\n\twv.url = copyFileToAppData('test.html').nativePath;\r\n});\r\n\r\nfunction copyFileToAppData(name) {\r\n\tvar oldfile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, name);\r\n\tTi.API.info('\\n');\r\n\tTi.API.info('\\n#### oldfile path: ' + oldfile.nativePath);\r\n\tvar newfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, name);\r\n\tnewfile.write(oldfile.read()); // both old.txt and new.txt exist now\r\n\tTi.API.info('\\n#### newfile path: ' + newfile.nativePath);\r\n\tTi.API.info('\\n');\r\n\treturn newfile;\r\n}\r\n\r\nvar wv = Ti.UI.createWebView({\r\n\ttop: 100,\r\n\tbottom: 0,\r\n\tleft: 0, right: 0\r\n});\r\nwin.add(wv);\r\n{code}\r\n\r\n{code:title=test.html}\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n

This is a test

\r\n

Background should be light blue.

\r\n \r\n\r\n\r\n{code}\r\n\r\n{code:title=test.css}\r\nbody {\r\n background-color: #d0e4fe;\r\n}\r\n\r\nh1 {\r\n color: orange;\r\n text-align: center;\r\n}\r\n\r\np {\r\n font-family: \"Times New Roman\";\r\n font-size: 20px;\r\n}\r\n{code}\r\n\r\n{code:title=test.js}\r\nfunction testClick() {\r\n alert('Hi');\r\n}\r\n{code}", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-23T23:00:17.000+0000", "updated": "2014-09-23T23:00:38.000+0000" }, { "id": "325377", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thank you for the testcase. That worked! \r\nIs it still possible to access the test.css/test.js file inside the applicationDataDirectory when the index.html is inside the Ressource folder? Or do I have to copy all files from Ressource to applicationDataDirectory first? On iOS7 you could just add \"../Documents\" before locally referenced files.", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-09-24T06:21:06.000+0000", "updated": "2014-09-24T06:21:06.000+0000" }, { "id": "325444", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Not a problem.\r\n\r\nNo, the folders have actually been moved which is why your workaround stopped working. You would have to figure out what the relative path is and use that, but Apple says that you should not do that [here|https://developer.apple.com/library/ios/technotes/tn2406/_index.html].\r\n{code}\r\nCode which attempts to derive the path to the Documents or Library directories will return an invalid path on iOS 8. \r\nAttempting to access this path will fail, and may terminate your app.\r\n{code} \r\n\r\nEven if you ignore what Apple says and could get it to work, there is no guarantee that it won't break again in the future.\r\nCopying all of the files over is definitely the way to do it.", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-24T16:44:57.000+0000", "updated": "2014-09-24T16:44:57.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }