问题
I m trying to set alarm from app with my audio file but getting lots of messages like
Use of undeclared identifier EKAlarm
Unknown receiver EKEvent did you mean UIEvent
Member reference base type 'int" is not a structure or union
@property (retain, nonatomic) EKAlarm *alarm;
@synthesize alarm;
-(void) AlarmAction:(id)sender{
EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-300];
[EKEvent addAlarm:alarm];
alarm.soundName =
}
Thanks for help.
回答1:
Have you added the EventKit framework? It must be added under Link Binary With Libraries under the Build Phases tab of your project properties.
====== EDIT:
You should be using UILocalNotification (Class Reference). You should:
- Create an instance of UILocalNotification,
- Set the
fireDateproperty to the time you would like the alarm to fire, - If desired, set the
repeatIntervalto some NSCalendarUnit (see here), - Set the
soundNameproperty to the file name of the audio file you wish to play, - Finally, schedule it with
[[UIApplication sharedApplication] scheduleLocalNotification: myNotification];
来源:https://stackoverflow.com/questions/14775954/set-ekalarm-in-iphone-app