ios - Trying to create UILocalNotification repeating every weekday -
I am trying to create a replicated local notification using Xamarin.IOS. I have to give a different warning body message every day, for example "it is Monday", "this is a Tuesday day" and so on.
My problem is that only the first information is working, I have read the documentation, and the correct method of making the repetition of some tutorials is to loop through each day and make a total of seven notifications That the repeater interval property is set to NSCalendarUnit.Weekday.
My code is slightly confusing at this time ... My question is, how can I make a local notification that should be repeated every day, but with different alerts body messages based on week? Add this code to the loop (int i = 0; i & lt; = 6; i ++) {NSDAT Component Component = Greg Calendars.Companies (NSCAllaryRent.DE | NSCLandERUnit.Sy | NSCALendarUnit.Month, DateTime.AdWords (i) .Onsdate ()); Components.DAY = date time.NEW Add Day (i). day; Components Death = date time.Now Add Day (i). Death; Component. Year = date time.Now Add Day (i). year; NSDT ReferenceData = Greg Calendars Data Components (Component); NSDateComponents componentsForFireDate = gregCalendar.Components (NSCalendarUnit.Year | NSCalendarUnit.Hour | NSCalendarUnit.Minute, Reference Date); ComponentsForFireDate.Year = components. year; Components ForFireDate.Month = components.Month; Components ForFireDate.Day = Component. ComponentsForFireDate.Hour = 8; ComponentsForFireDate.Minute = 0; Var dayOfWeek = (int) DateTime.Now Adwords (i). DEAF WICK + 1; If (day off wake == 8) dayoffice = 1; FireFidet for components Wee = Day off wake; NSDate fireDateOfNotification = gregCalendar.DateFromComponents (componentsForFireDate); UILocalNotification Local Information = New UILLocal Notification (); Local notifications. Firedate = firedate up notification; Local notifications. Timezone = nystimjon.local time zone; Local notifications. Alertbodie = Day of Wake; Local notifications. AlertAction = "Daily"; Local notifications. Recurrence Calendar = NSCalendar.CurrentCalendar; Local notifications. Repeat interval = NSCalendarUnit.Weekday; Local notifications. Application IconBadgeNumber = 1; UIApplication.SharedApplication.ScheduleLocalNotification (Local Information); }
switch (i) {Case 0: // mon localNotification.alertbody = @ "Monday .... you message"; break; Case 1 // tue localNotification.alertbody = @ "Tuesday .... You Message"; break; Case 2: // with localization Alertby = @ "Wednesday .... Your Message"; break; ... ...}
Comments
Post a Comment