对于iOS,我可以使用以下代码发送包含自定义文本的电子邮件链接。
NSString *emailString = [NSString stringWithFormat:@"<a href=https://www.google.com/>test</a>"];
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setMessageBody:emailString isHTML:YES];
[self presentViewController:mailController animated:YES
completion:nil];
但是,我无法为Mac复制相同的功能。
NSString *emailString = [NSString stringWithFormat:@"<a href=https://www.google.com/>test</a>"];
NSArray *shareItems = @[emailString];
NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail];
service.delegate = self;
[service performWithItems:shareItems];
我不知道这是否可行。任何建议表示赞赏