我想添加事件在我的iPhone日曆,我成功添加事件在我的iPhone日曆。但是,我想要獲得所有當前月份活動,並且我想將活動文件(.ical)附加到我的MFMailComposer中。在MFMailComposerController中附加iCal文件?
0
A
回答
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];
更多信息apple docs。
爲了得到啓動和月末可以使用例如從這個項目:https://github.com/melsam/NSDateCategoryForReporting
,並以此作爲一個例子如何事件導出到文件的.iCal https://github.com/mysterioustrousers/EKEventToiCal/blob/master/EKEventToiCal/
要發送的.iCal文件使用IronManGill答案的代碼,但將mimeType更改爲文字/日曆
[picker addAttachmentData:data mimeType:@"text/calendar" fileName:@"/abc.ical"];
0
那麼我可以爲您提供解決方法。如果您獲得.ical文件,請訪問它。你可以將其轉換成.zip文件,請到通過這些鏈接: -
How can I create a zip file by using Objective C?
How to zip folders in iPhone SDK?
Creating zip files in ObjectiveC for iPhone
然後在MFMailComposer
重視它非常久遠的電子郵件使用這個
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *WritableDBPath= [documentsDirectory stringByAppendingPathComponent:kFilename];
NSData *data = [NSData dataWithContentsOfFile:WritableDBPath];
[picker addAttachmentData:data mimeType:@"application/zip" fileName:@"/abc.zip"];
[picker setSubject:@"Database"];
[picker setMessageBody:@"Database testing" isHTML:NO];
[self presentModalViewController:picker animated:YES];
希望這會有所幫助。
相關問題
- 1. MFMailComposerController
- 2. 從iCal文件
- 3. 在pipedrive中附加文件
- 4. Outlook無法識別ical附件
- 5. 從文件中讀取iCal信息以使iCal事件發生
- 6. 不要正確獲得iCal附件在Gmail中
- 7. 文件附加在word文檔中
- 8. 在電子郵件中附加文件
- 9. 在郵件中附加兩個文件
- 10. 的PHPMailer如何發送內聯iCal和文檔附件
- 11. 在c中加載不帶附件的附件文件名#
- 12. 如何在附加文件
- 13. 幫助生成ical文件
- 14. 在web表單portlet中附加文件
- 15. 在javascript中附加json文件
- 16. 在VBA中附加html文件
- 17. 使用groovy在SoapUI中附加文件
- 18. 如何在Eclipse中附加源文件?
- 19. 在Sendgrid中附加ics文件
- 20. 使用maven在文件中附加值
- 21. 在Postfix過濾器中附加文件
- 22. 在.Net中附加一個txt文件
- 23. 在java中附加墊文件
- 24. 如何在HTML中附加文件?
- 25. Mailgun - 在phantomjs中附加文件
- 26. 在.NET中附加.txt文件
- 27. 如何在文件中附加記錄
- 28. 如何在VB.NET中附加PDF文件?
- 29. phpmailer附加文件
- 30. YAML附加文件