我已經搜索到了很多,並且很驚訝沒有像這樣出現。 我試圖發送一個音頻文件電子郵件附件(使用MFMailComposeViewController)在文件名中有中文/漢字字符。奇怪的是,當我在文件名中使用特定的字符時,當我收到電子郵件時,它變成了一大串怪異的字符。MFMailComposeViewController帶有外部字符的文件附件名稱
有了「平成23年.m4a」這樣的文件名,收到電子郵件時的附件名變成「平成23 」/%1B%28B8%1B%24B7n%1B%28B25%1B %24 ...「這是造成這種情況的字符」年「,如果我刪除了這個字符,一切都很好,可能會有另外一箇中文/漢字字符可能導致同樣的問題,但我不知道如何甚至開始解決這個問題...我一直在拉我的頭髮,所以希望有人可以幫我這個...
也有一個類似的問題是,與某些電子郵件提供商(工作正常的Gmail,雅虎,但不適用於gmboy.com之類的東西),如果我在文件名中包含日文字符,則它們將無法顯示並被下劃線符號替換(例如,Testテスト.m4a變成Test_.m4a)我覺得這可能與上面的問題有關。
這裏是我的代碼...
/* Set up the mail compose view and put in the body/attachment */
MFMailComposeViewController *mailComposer = [[[MFMailComposeViewController alloc] init] autorelease];
NSMutableDictionary *dict = [[self itemsToSend] objectAtIndex:0];
NSString *path = [dict objectForKey:@"exportFileAddress"];
NSData *myData = [NSData dataWithContentsOfFile:path];
NSString *fileName = @"平成23年.m4a";
[mailComposer addAttachmentData:myData mimeType:@"audio/m4a" fileName:fileName];
[mailComposer setMessageBody:@"Test email" isHTML:YES];
/* Set default subject */
[mailComposer setSubject:@"Email subject"];
mailComposer.mailComposeDelegate = self;
[self presentModalViewController:mailComposer animated:YES];
文件附件名稱將顯示就好了,當MFMailComposeViewController觀點出現,但不知何故,在發送過程中,得到了名搞砸了。
任何幫助將非常感謝!
看起來像我的一個iOS bug。 – Akshay
哦,我沒有注意到你的評論Akshay。感謝您的意見。就像我在下面說的,我剛剛嘗試使用默認的iOS應用程序,併發生同樣的問題。所以是的,這不僅僅是我錯誤地使用了API ... – kaka123