path = { R : Titanium.Filesystem.resourcesDirectory, A : Titanium.Filesystem.applicationDirectory, T : Titanium.Filesystem.tempDirectory, AP : Titanium.Filesystem.applicationDataDirectory }; Ti.App.path = path; function fetchImage(url, town, position, callback) { var c = Titanium.Network.createHTTPClient(); c.onload = function() { var path = 'scroll_images/' + town + "-photos-" + position + ".jpg"; var imageDir = Ti.Filesystem.getFile(dir_path.AP, 'scroll_images'); if (!imageDir.exists()) { // alert("Creating scroll image directory"); imageDir.createDirectory(); } var imageFile = Ti.Filesystem.getFile(dir_path.AP, path); // alert("path:"+path); // var f = Titanium.Filesystem.getFile(dir_path.AP,path); if (!imageFile.exists()) { // alert("data:"+this.responseData); imageFile.write(this.responseData); } // dispose of file handles imageFile = null; imageDir = null; callback("Image Loaded"); }; // open the client c.open('GET', url); // send the data c.send(); }We have been using this code to load a downloaded image to the AP location, which we thought was correct, but Apple just rejected our App, and said it needs to go in:
- Data that can be downloaded again or regenerated should be stored in the <Application_Home>/Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.
How can we map to this directory?
We are also storing data inside the sqllite database, so not sure if this is also causing an issue for the iCloud backup, which is the main problem at the moment.
1 Answer
Accepted Answer
Ti.Filesystem.applicationDataDirectory+'../Library/Private%20Documents/';
Ti.Filesystem.applicationDataDirectory+'../Library/Caches/';
Your Answer
Think you can help? Login to answer this question!