3
我想在iphone中通過電子郵件發送帶.caf擴展名的音頻文件。任何人都可以幫助我做到這一點?我寫了mimeType:@"audio/caf"
,但我認爲它不支持。請幫我做這個小任務。如何通過iPhone中的電子郵件發送.caf文件?
我想在iphone中通過電子郵件發送帶.caf擴展名的音頻文件。任何人都可以幫助我做到這一點?我寫了mimeType:@"audio/caf"
,但我認爲它不支持。請幫我做這個小任務。如何通過iPhone中的電子郵件發送.caf文件?
使用下面的代碼: -
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filepath = [documentsDirectory stringByAppendingPathComponent:memo.memoUrl];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filepath];
NSData *dataToSend = [[NSData alloc] initWithContentsOfURL:fileURL];
[fileURL release];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Recording"];
// Set up recipients
NSArray *toRecipients = nil;
NSArray *ccRecipients = nil;
NSArray *bccRecipients = nil;
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
[picker setMessageBody:@"" isHTML:YES];
[picker addAttachmentData:dataToSend mimeType:@"audio/x-caf" fileName:[NSString stringWithFormat:@"voice-memo.caf", memo.memoName]];
是啊..我用過mimetype:@「audio/caf」,我的錯誤是我沒有在文件名後面寫入.caf擴展名..一旦我在文件名後面添加了.caf擴展名,它就開始工作了。方式感謝。 –
你對你是如何做的代碼? –