Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15513] iOS7: Write data to file couldn't be completed in Ti.Filesystem.applicationSupportDirectory

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2013-10-24T21:15:46.000+0000
Affected Version/sRelease 3.1.3
Fix Version/s2013 Sprint 23, 2013 Sprint 23 API
ComponentsiOS
Labelsios7, supportTeam
ReporterEduardo Gomez
AssigneeIngo Muschenetz
Created2013-10-17T17:41:19.000+0000
Updated2017-03-21T18:12:24.000+0000

Description

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"}

Comments

  1. Pedro Enrique 2013-10-24

  2. Lee Morris 2017-03-21

    Closing ticket as the issue will not fix.

JSON Source