Issue description
Developer is seeing this error on iOS 7 only. When he attempts to write the data to a file object. iOS 6 does not seem to be affected, location is below:
{quote}
var snapFolder = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, "../Caches/Snapshots");
{quote}
Snippet code
On this particular use case, on iOS 7, the Snapshots directory is still present. It seems like the delete step did not work although the error message seems to indicate the write step failing.
var win = Ti.UI.createWindow({
backgroundColor : 'white',
orientationModes : [Ti.UI.PORTRAIT]
});
win.open();
var label = Ti.UI.createLabel({
text : 'No app event received. Make call while running app',
textAlign : 'center',
width : 'auto'
});
win.add(label);
Titanium.App.addEventListener('pause', function() {
// this will delete the Snapshots folder and create a file in its place
// so that the folder cannot be recreated
var snapFolder = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, "../Caches/Snapshots");
snapFolder.deleteDirectory(true);
snapFolder.write("No Folder for you!");
label.text = "App has been paused";
});
Titanium.App.addEventListener('resume', function(e) {
label.text = "App has resumed";
});
Console logs
Oct 17 09:08:43 QA291-iphone-5s App-Phone[558] <Warning>: [ERROR] Could not write data to file at path "/var/mobile/Applications/9C33C952-64EA-4F11-83B2-FC7513DCC1AS/Library/Caches/Snapshots" - details: Error Domain=NSCocoaErrorDomain Code=513 "The operation couldn’t be completed. (Cocoa error 513.)" UserInfo=0x19086c00 {NSFilePath=/var/mobile/Applications/9C33C952-64EA-4F11-83B2-FC7513DCC1AS/Library/Caches/Snapshots, NSUnderlyingError=0x17eb2fc0 "The operation couldn’t be completed. Operation not permitted"}
Closing ticket as the issue will not fix.