ios - UILocalNotification keeps pushes multiple messages -


i have struct arraybook holds array , function called randomlist returns array , passes random number through e.g. return arraylist[randomnumber]. when call arraybook.randomlist return random item array everytime executed - have tested in playgrounds , xcode unbutton function.

now clear, have functioning uilocalnotification schedules local push notification hourly (for testing) message being arraybook.randomlist. when receiving notification application pushes multiple messages @ once increase 1 every hour. cannot figure out why is, ideas ?

    var datecomp:nsdatecomponents = nsdatecomponents()     datecomp.year = 2015;     datecomp.month = 06;     datecomp.day = 03;     datecomp.hour = 01;     datecomp.minute = 00;     datecomp.timezone = nstimezone.systemtimezone()      var calender:nscalendar = nscalendar(calendaridentifier: nscalendaridentifiergregorian)!     var date:nsdate = calender.datefromcomponents(datecomp)!      var notification:uilocalnotification = uilocalnotification()     notification.category = "daily"     notification.alertbody = arraybook.randomlist()     notification.firedate = date     notification.repeatinterval = nscalendarunit.calendarunithour     notification.soundname = uilocalnotificationdefaultsoundname 

presumably calling code schedule notification repeatedly - have otherwise same alertbody since set when notification scheduled, not when notification delivered.

since specify notification.repeatinterval = nscalendarunit.calendarunithour notification delivered every hour along of other notifications have scheduled - increasing 1 each time. should remove repeatinterval notification.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -