Skip to content

Instantly share code, notes, and snippets.

@yuxiangq
Last active May 22, 2016 15:15
Show Gist options
  • Save yuxiangq/f24490a827342d04f12138c9d8e5c22c to your computer and use it in GitHub Desktop.
Save yuxiangq/f24490a827342d04f12138c9d8e5c22c to your computer and use it in GitHub Desktop.
创建EKEvent
...
- (void)createEvent {
EKEvent *event = [EKEvent eventWithEventStore:self.es];//
//可以设置event的相关属性,title表示标题,notes表示备注,-(void)addAlarm:(EKAlarm *)alarm;方法可以添加提醒时间...
[self.es saveEvent:event span:EKSpanThisEvent error:nil];//这个时候会生成Event对应的唯一Identifier。
/*EventStore还支持批量写入Event。*/
/*使用-(BOOL)saveEvent:(EKEvent *)event span:(EKSpan)span commit:(BOOL)commit error:(NSError **)erro;方法,commit设为NO*/
/*然后再调用[EKEventStore commit:]一次性提交所有新增*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment