1
我想創造出具有查看日曆事件的能力的應用程序。我能夠讀取所有的屬性,但是在使用EKAlarm時遇到了問題。當我在for循環中執行一個NSLog時,它確認它應該打到15分鐘的警報日誌,但它正在傳遞它。EKAlarm/EKEvent
for (int i = 0; i < [event1.alarms count]; i++) {
if ([event1.alarms objectAtIndex:i] == [EKAlarm alarmWithRelativeOffset:-900]) {
NSLog(@"alarm: 15 min before");
}else if([event1.alarms objectAtIndex:i] == [EKAlarm alarmWithRelativeOffset:-1800]) {
NSLog(@"alarm: 30 min before");
}else if([event1.alarms objectAtIndex:i] == [EKAlarm alarmWithRelativeOffset:-3600]) {
NSLog(@"alarm: 1 hour before");
}else if([event1.alarms objectAtIndex:i] == [EKAlarm alarmWithRelativeOffset:-86400]) {
NSLog(@"alarm: 1 day before");
}
}