我工作的一個應用程序,其中,如果用戶選擇一個聲音,它們可以從應用程序發送給自己。附加MP3文件直接從應用程序發送電子郵件?
安裝部「出現」工作,然而,當我發送電子郵件,收件人沒有附件?
在iPad/iPhone本身,它看起來是連接它時,它涉及到創作,但它不工作? :/
這裏是我使用的代碼;
- (void)onSend:(id)sender{
int nIndex;
UIButton *btnSender = (UIButton *)sender;
NSLog(@"%d", btnSender.tag);
for (int i = 0; i < [ m_aryFileName count ]; i++) {
if(i == (btnSender.tag - 100)){
nIndex = i;
}
}
NSString *strFileName = [ m_aryFileName objectAtIndex:nIndex ];
strFileName = [ strFileName stringByAppendingString:@".mp3" ];
NSData* nData = [ NSData dataWithContentsOfFile:strFileName ];
MFMailComposeViewController *pickerMail = [[MFMailComposeViewController alloc] init];
pickerMail.mailComposeDelegate = self;
[pickerMail setSubject:@"myMail Attachment"];
// Attach an image to the email
[pickerMail addAttachmentData:nData mimeType:@"audio/mp3" fileName:strFileName ];
// Fill out the email body text
NSString *emailBody = @"Here is your attachment";
[pickerMail setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:pickerMail animated:YES];
[pickerMail release];
}
它只是重視所謂ATT00001.txt :( – user1695971 2013-02-27 13:49:15
你試試我的隊友代碼.txt文件? – 2013-02-27 13:51:06
是的,它只是附加的文件爲.txt文件不是一個mp3文件,它不會打開。 – user1695971 2013-02-27 13:59:11