[TIMOB-15243] iOS7: Saving file to applicationDataDirectory results in incorrect path
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-09-17T23:08:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | filesystem, ios7, mobile |
Reporter | Marco Aiello |
Assignee | Shak Hossain |
Created | 2013-09-17T08:28:01.000+0000 |
Updated | 2017-03-31T20:33:07.000+0000 |
Description
I use this code:
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,"test.pdf");
var ret = f.write(this.responseData);
After "f.nativePath" value is:
file:///Users/marco/Library/Application%20Support/iPhone%20Simulator/7.0/Applications/A7304977-7E4F-489D-A143-045F52975DED/MyApp.app/file:/Users/marco/Library/Application%2520Support/iPhone%2520Simulator/7.0/Applications/A7304977-7E4F-489D-A143-045F52975DED/Documents/test.pdf
and i can't load this url from webview or documentviewer
Any suggestion please?
Which version of the SDK are you using? are you using 3.1.3?
Does the file save without error? It's just the display that is the problem?
What if you try and manually find that URL on your computer?
I assume this is the simulator, yes?
1. ios sdk 7.0, Titanium Studio 3.1.2 GA 2. no, file is not saved! 3. folder/file not found - file not saved! 4. yes, simulator
Please try the latest 3.1.3 SDK (http://builds.appcelerator.com.s3.amazonaws.com/index.html#3_1_X). 3.1.2 may not work on iOS 7.
I've updated Titanium with the latest SDK (3.1.3) but nothing ... always the same problem ...
Can you please post the updated URL you get when saving the file with 3.1.3, and the exact SDK version you are using?
This is the code we used for testing
Check to see if Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory is returning a trailing slash or not. I have found a couple of occasions over the past few versions of the Ti SDK where this is inconsistent, causing double-slash paths to crop in to apps here and there.
Is this related? https://developer.appcelerator.com/question/153484/ios-7-compatibility-with-titanium-app#answer-264403
Unable to reproduce this issue, tested with the following environment; iPhone 7 and Simulator (10.2) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.2 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80