gpt4 book ai didi

iphone - 将 UIPasteBoard 中的 vCard 粘贴到邮件中

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:45:57 26 4
gpt4 key购买 nike

我复制一个vcard(包含在bundle中)到通用粘贴板如下:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"AM" ofType:@"vcf"]; 
NSData *data = [NSData dataWithContentsOfFile:filePath];
[[UIPasteboard generalPasteboard] setData:data forPasteboardType:(NSString*)kUTTypeVCard];

然后我希望用户能够将其粘贴到电子邮件中。但是,当它被复制到粘贴板时,Mail 不提供粘贴选项。是我做错了什么还是 Mail 无法识别该粘贴板类型?

最佳答案

你可以像这样直接将它添加到消息中

MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"AM ofType:@"vcf"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
[mailViewController addAttachmentData:data mimeType:@"text/vcard" fileName:@"AM.vcf"];
mailViewController.mailComposeDelegate = self;
[self presentModalViewController:mailViewController animated:YES];
[mailViewController release];

关于iphone - 将 UIPasteBoard 中的 vCard 粘贴到邮件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9117702/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com