0

I am writing an alarm app. In the app, user can select days from the picker for setting alarm on that day with time. But I don't know to set alarm (UILocalNotification) for specific day in a week (0 - 7).

I just wanted to set fire date of UILocalNotification on specific day like ex. Monday, Friday and Sunday..

I have searched on net and got many similar forums but none of them worked for me.

Any suggestions ?

user1859900
  • 81
  • 1
  • 2
  • 10

2 Answers2

1

Set the local notification fireDate for the first notification that should be made. Then set the repeatInterval for the duration between any notification and the next notification.

Wain
  • 118,658
  • 15
  • 128
  • 151
1

It would be more helpful if you have included codes which you have tried. Anyways,

NSDate myOwnDate; // myOwnDate can be a date that is on a specific day. Make sure it is a valid date variable

UILocalNotification* local_notification = [[UILocalNotification alloc] init];
[local_notification setFireDate:myOwnDate]; 
[local_notification setRepeatInterval:NSWeekCalendarUnit];
[local_notification setAlertBody: @"Your alarm is ringing!"];

UIApplication* app = [UIApplication sharedApplication];
[app scheduleLocalNotification:local_notification];

Pretty straightforward I would say.

Joel Tay
  • 83
  • 1
  • 9