mailto
您的客户端应用程序必须为URL 方案注册自己。将此添加到您的 Info.plist:
<array>
<dict>
<key>CFBundleURLName</key>
<string>mailto: urls</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mailto</string>
</array>
</dict>
</array>
</plist>
它需要处理事件。这可以是一个开始:
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
}
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
NSString *link = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
/* do something with the link */
}
目前尚不清楚 [对我来说] 你将如何发送附件。在 Finder 中共享 > 电子邮件?无论如何,您可能需要添加一些东西来处理附件。