Created
December 29, 2019 13:38
-
-
Save exclusiveTanim/029bee84db1c4080a871fd1e9cf3acc9 to your computer and use it in GitHub Desktop.
Example where data saving will get failed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
backgroundColor: '#fff' | |
}); | |
var btn = Ti.UI.createButton({ | |
title: 'Save File' | |
}); | |
btn.addEventListener('click', function() { | |
var key = 'path'; | |
var dataFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, key); | |
var data = undefined; | |
//var data; | |
var str = JSON.stringify(data); | |
Ti.API.info(str); | |
var isFileSaved = dataFile.write(str); | |
if (isFileSaved) { | |
Ti.API.info('file saved'); | |
} else { | |
Ti.API.info('file saving failed'); | |
} | |
}); | |
win.add(btn); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment