本文介绍了在MFMailComposerController中附加iCal文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 iPhone日历中添加活动,我已成功在我的iPhone日历中添加了活动.但是,我想获取所有当前月"事件,并且希望将该事件文件(.ical)附加到我的 MFMailComposer 中.

I want to add Event in my iPhone Calendar, i Successfully add the Event in my iPhone calendar. But, i want to get the all Current Month event and i want to attach that Event file (.ical) in my MFMailComposer.

推荐答案

读取事件非常简单.

// 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

To get start and end of the month you can use example from this project: https://github.com/melsam/NSDateCategoryForReporting

并以此为例,如何将事件导出到.ical文件 https://github.com/mysterioustrousers/EKEventToiCal/blob/master/EKEventToiCal/

And use this as an example how to export Events to .ical filehttps://github.com/mysterioustrousers/EKEventToiCal/blob/master/EKEventToiCal/

要发送.ical文件,请使用IronManGill答案中的代码,但将mimeType更改为text/calendar

To send .ical file use the code from IronManGill answer but change mimeType to text/calendar

[picker addAttachmentData:data mimeType:@"text/calendar" fileName:@"/abc.ical"];

这篇关于在MFMailComposerController中附加iCal文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 10:21