2013-08-07 22 views

回答

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]; 

希望這會有所幫助。