0

I am making an iphone app, in which there is one alarm implementation module. In this alarm implementation I have to set alarm, and this alarm can be number of times in a day at different times and can be for a number of days. I want to use the calendar API for it. How can I set alarm by using calendar API. How can I implement this concept. If some one know about this concept. Please help me.

Thanks in advance.

progrmr
  • 75,956
  • 16
  • 112
  • 147
Minkle Garg
  • 723
  • 3
  • 9
  • 35
  • You should look at [UILocalNotification class](http://developer.apple.com/library/ios/#documentation/iPhone/Reference/UILocalNotification_Class/Reference/Reference.html), it can do some of what you want but it has [limitations](http://stackoverflow.com/questions/6966365/uilocalnotification-repeat-interval-for-custom-alarm-sun-mon-tue-wed-thu-fr/6966665#6966665) – progrmr Aug 19 '11 at 14:26

2 Answers2

2

Im assuming you want a push notification of some sort? Like a UIAlertView. This is called a UILocalNotification.

UILocalNotification *localNotif = [[UILocalNotification alloc]init];
[localNotif setFireDate:[NSDate dateWithTimeInterval:10.0f sinceDate:[NSDate new]]]; // the date to fire
[localNotif setAlertAction:@"Test"]; // title
[localNotif setAlertBody:@"This is a test"]; // tells you what to put in the description
[localNotif setRepeatInterval: NSWeekCalendarUnit]; // repeat interval, what you asked for
[[UIApplication sharedApplication]scheduleLocalNotification:localNotif]; // put it into the application
[localNotif release];

This fires a notification in ten seconds and repeats it on a weekly basis from the date you specified(I believe so please comment if im wrong fellow programmers).

You are bound to these options

NSEraCalendarUnit NSYearCalendarUnit NSMonthCalendarUnit NSDayCalendarUnit NSHourCalendarUnit NSMinuteCalendarUnit NSSecondCalendarUnit NSWeekCalendarUnit NSWeekdayCalendarUnit NSWeekdayOrdinalCalendarUnit NSQuarterCalendarUnit

Arvin Am
  • 533
  • 4
  • 11
-2

can be no of times in a day at different time and can be for no of days

What on earth does that mean?

I dont fully understand what you are referring too.

FYI, take a look at this: http://developer.apple.com/library/iOS/#documentation/UIKit/Reference/UIDatePicker_Class/Reference/UIDatePicker.html

AMAN77
  • 6,218
  • 9
  • 45
  • 60
Cyrille
  • 25,014
  • 12
  • 67
  • 90