diff options
Diffstat (limited to 'Copy Mailto/DefaultURLHandler.m')
-rw-r--r-- | Copy Mailto/DefaultURLHandler.m | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Copy Mailto/DefaultURLHandler.m b/Copy Mailto/DefaultURLHandler.m new file mode 100644 index 0000000..424a0ee --- /dev/null +++ b/Copy Mailto/DefaultURLHandler.m @@ -0,0 +1,24 @@ +// +// DefaultURLHandler.m +// CopyMailto +// +// Created by tw on 9/5/18. +// Copyright © 2018 tw. All rights reserved. +// + +#import "DefaultURLHandler.h" + +@implementation DefaultURLHandler + ++ (OSStatus)setDefaultURLHandler { + CFStringRef scheme = (CFStringRef)@"mailto"; + CFStringRef bundle_identifier = (__bridge CFStringRef)[[NSBundle mainBundle] bundleIdentifier]; + + OSStatus status = LSSetDefaultHandlerForURLScheme(scheme, bundle_identifier); + + CFRelease(scheme); + + return status; +} + +@end |