iPhoneカレンダーにイベントを追加したいのですが、iPhoneカレンダーにイベントを正常に追加できました。しかし、今月のすべてのイベントを取得したいので、そのイベント ファイル (.ical)をMFMailComposerに添付したいと考えています。
2 に答える
3
イベントの読み取りは非常に簡単です。
// Create the predicate from the event store's instance method
NSPredicate *predicate = [store predicateForEventsWithStartDate:startOfTheMonth
endDate:endOfTheMonth
calendars:nil];
// Fetch all events that match the predicate
NSArray *events = [store eventsMatchingPredicate:predicate];
詳細については、アップルのドキュメントを参照してください。
月の始まりと終わりを取得するには、このプロジェクトの例を使用できます: https://github.com/melsam/NSDateCategoryForReporting
そして、これを例として使用して、イベントを .ical ファイルにエクスポートする方法 https://github.com/mysterioustrousers/EKEventToiCal/blob/master/EKEventToiCal/
.ical ファイルを送信するには、IronManGill の回答のコードを使用しますが、mimeType を text/calendar に変更します
[picker addAttachmentData:data mimeType:@"text/calendar" fileName:@"/abc.ical"];
于 2013-08-07T08:33:17.100 に答える