iphone - UILocalNotification app crash when repeat interval set to hourly -



iphone - UILocalNotification app crash when repeat interval set to hourly -

otherrepeat intervals work fine, when set notification repeat hourly , timer goes off, app freezes, , can't reopen app until clear local notifications.

switch(repeattype) { case krepeathourly: notif.repeatinterval = nshourcalendarunit; break; case krepeatdaily: notif.repeatinterval = nsdaycalendarunit; break; case krepeatweekly: notif.repeatinterval = nsweekcalendarunit; break; case krepeatmonthly: notif.repeatinterval = nsmonthcalendarunit; break; case krepeatannually: notif.repeatinterval = nsyearcalendarunit; break; default: break; }

- (void)schedulenotification { [remindertext resignfirstresponder]; [[uiapplication sharedapplication] cancelalllocalnotifications]; class cls = nsclassfromstring(@"uilocalnotification"); if (cls != nil) { uilocalnotification *notif = [[cls alloc] init]; notif.firedate = [datepicker date]; notif.timezone = [nstimezone defaulttimezone]; notif.alertbody = @"did forget something?"; notif.alertaction = @"show me"; notif.soundname = uilocalnotificationdefaultsoundname; notif.applicationiconbadgenumber = 1; nsinteger index = [schedulecontrol selectedsegmentindex]; switch (index) { case 1: notif.repeatinterval = nsminutecalendarunit; break; case 2: notif.repeatinterval = nshourcalendarunit; break; case 3: notif.repeatinterval = nsdaycalendarunit; break; case 4: notif.repeatinterval = nsweekcalendarunit; break; default: notif.repeatinterval = 0; break; } nsdictionary *userdict = [nsdictionary dictionarywithobject:remindertext.text forkey:kremindmenotificationdatakey]; notif.userinfo = userdict; [[uiapplication sharedapplication] schedulelocalnotification:notif]; [notif release]; } }

for more detail download source code form reference link here

iphone ios ipad uilocalnotification repeat

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -