ios - Local Notification not always sending -
i set local notification fire off @ 7:45:01 pm every day, not firing on daily basis @ time.
any idea i'm missing here? i've tried editing code, still stuck knowing i'm missing.
will post code needed, thanks!
appdelegate.m
:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { if ([application respondstoselector:@selector(registerusernotificationsettings:)]) { [application registerusernotificationsettings:[uiusernotificationsettings settingsfortypes:uiusernotificationtypealert|uiusernotificationtypebadge|uiusernotificationtypesound categories:nil]]; } return yes; }
viewcontroller.m
:
- (void)viewdidload { [super viewdidload]; uilocalnotification* localnotification = [[uilocalnotification alloc] init]; nscalendar *cal = [nscalendar currentcalendar]; nsdatecomponents *comp = [cal components:(nscalendarunityear | nscalendarunitmonth | nscalendarunitday | nscalendarunithour | nscalendarunitminute) fromdate:[nsdate date]]; comp.hour = 19; // 19 = 7pm comp.minute = 45; // 7:45 pm comp.second = 01; // 7:45:01 pm localnotification.firedate = [cal datefromcomponents:comp]; localnotification.alertbody = @"local notification in ios8"; localnotification.timezone = [nstimezone defaulttimezone]; [[uiapplication sharedapplication] schedulelocalnotification:localnotification]; }
i set local notification fire off @ 7:45:01 pm every day
no, didn't. set local notification fire off once. didn't set repeatinterval
not repeating notification. fires once , that's that.