Hi everybody,
I´m trying to use the example code from appcelerator documentation to see how to insert an evente on an especific calendar i have in my iphone. if i open the calendar app i see gmail calendar , default calendar, icloud calendar , etc but the example method returns tha i have no calendars.
this is the code i´m using:
function FirstView() { //create object instance, a parasitic subclass of Observable var self = Ti.UI.createView(); //label using localization-ready strings from <app dir>/i18n/en/strings.xml var label = Ti.UI.createLabel({ color : '#000000', text : 'Seleccionar fecha:', height : 'auto', width : 'auto' }); self.add(label); var pickDesde = Ti.UI.createPicker({ type : Ti.UI.PICKER_TYPE_DATE, minDate : new Date(2009, 0, 1), maxDate : new Date(2020, 11, 31), value : new Date(2014, 3, 12), top : 10, left : 10 }); self.add(pickDesde); var pickHasta = Ti.UI.createPicker({ type : Ti.UI.PICKER_TYPE_DATE, minDate : new Date(2009, 0, 1), maxDate : new Date(2020, 11, 31), value : new Date(2014, 3, 12), top : 250, left : 10 }); self.add(pickHasta); //Add behavior for UI var butonCalendar = Ti.UI.createButton({ backgroundColor : 'purple', top : 400, right : 10, width : '60%', height : 40 }); self.add(butonCalendar); butonCalendar.addEventListener('click', function(e) { //aqui va el calendario. Ti.API.info('ALL CALENDARS:'); showCalendars(Ti.Calendar.allCalendars); }); function showCalendars(calendars) { for (var i = 0; i < calendars.length; i++) { Ti.API.info(calendars[i].name); alert(calendars[i].name); } } return self; } module.exports = FirstView;