Wenn ich eine App für den App Store/Play Store paketiere, sollte ich dann alle Aufrufe von Ti.API.info() entfernen oder werden sie ignoriert oder nicht einmal kompiliert?Entfernen Ti.API.info() beim Erstellen für Geschäfte?
0
A
Antwort
3
Nein, sie sind immer noch hier, guter Mann Fokke hat ein schönes Modul, ti-stealth, das funktioniert diese Arbeit für Sie.
1
quick and dirty Lösung keine Nachrichten in der Produktion log:
Wrap Ti.API.log in einer Funktion in alloy.js:
function log (msg) {
if (Alloy.CFG.debugging) {
Ti.API.log('>>> ' + msg);
}
}
log("My logged message");
Fügen debugging
Schlüssel in config.son:
{
"global": {},
"env:development": {
"debugging":true
},
"env:test": {
"debugging":true
},
"env:production": {
"debugging":false
}
}
1
Schnell und schmutzig, aber funktioniert: In alloy.js
function consLog(e)
{
if (!ENV_PRODUCTION)
console.log(JSON.stringify(e));
}
Und es verwendet:
consLog("Hello World");
+0
Dies ist nicht schnell und schmutzig. Weitere Informationen finden Sie hier: http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Controllers-section-34636384_AlloyControllers-ConditionalCode – Garre
Danke für die Info, aufgefordert, mich mit einer schnellen und schmutzigen Lösung zu kommen, siehe meine Antwort unten. – Dooderoo