당신이 응용 프로그램 세션에서 일부 값이 Ti.App.Properties 또는 SQL 데이터베이스입니다 보유 할 수있는 유일한 방법, 아이디어가있다. 따라서 다음과 같은 두 가지 방법으로 처리 할 수 있습니다.
해결 방법 1 : 원하는 속성을 삭제했는지 확인하려면 다른 속성을 사용하십시오.
// for first time installation, the default value (or 2nd parameter) will be false as you have not deleted the property yet
var isDeleted = Ti.App.Properties.getBool('My_Property_Deleted', false);
if (isDeleted) {
Ti.App.Properties.removeProperty("My_Property");
// since you have deleted it, now set it to true so this 'if' block doesn't runs on any next app session
Ti.App.Properties.setBool('My_Property_Deleted', true);
} else {
// you have already deleted the property, 'if' block won't run now
}
해결 방법 2 : 새 데이터베이스를 만들거나 앱을 DB를 제공 미리로드합니다.
// Titanium will create it if it doesn't exists, or return a reference to it if it exists (after first call & after app install)
var db = Ti.Database.open('your_db');
// create a new table to store properties states
db.execute('CREATE TABLE IF NOT EXISTS deletedProperties(id INTEGER PRIMARY KEY, property_name TEXT);');
// query the database to know if it contains any row with the desired property name
var result = db.execute('select * from deletedProperties where name=?', "My_Property");
if (result.rowCount == 0) { // means no property exists with such name
// first delete the desired property
Ti.App.Properties.removeProperty("My_Property");
// insert this property name in table so it can be available to let you know you have deleted the desired property
db.execute('insert into deletedProperties(name) values(?)', "My_Property");
} else {
// you have already deleted the property, 'if' block won't run now
}
// never forget to close the database after no use of it
db.close();
뿐만 아니라 다른 방법이있을 수 있지만,이 둘은 당신이 원하는 것을 위해 작동합니다. Read more about Ti.Database here