aboutsummaryrefslogtreecommitdiffstats
path: root/CopyMailto/DefaultURLHandler.m
diff options
context:
space:
mode:
authorTeddy Wing2018-09-05 19:57:58 +0200
committerTeddy Wing2018-09-05 19:57:58 +0200
commit8c20b1ce79316ccda8dd2c91c66f2388f16c45bf (patch)
tree802f8105344ad9daa01ac3b6ffa8f645fd39f204 /CopyMailto/DefaultURLHandler.m
parent83b7beb0c532a199e606d7ba05ffc38ea7e2cd7f (diff)
downloadCopy-Mailto-8c20b1ce79316ccda8dd2c91c66f2388f16c45bf.tar.bz2
DefaultURLHandler: Add `saveDefaultURLHandler`
This method is supposed to set CopyMailto as the default application for "mailto" URLs. But it keeps giving me a `-54` error, or `202` status code on the shell. WTF is going on?
Diffstat (limited to 'CopyMailto/DefaultURLHandler.m')
-rw-r--r--CopyMailto/DefaultURLHandler.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/CopyMailto/DefaultURLHandler.m b/CopyMailto/DefaultURLHandler.m
index 6ea69c1..8ce1728 100644
--- a/CopyMailto/DefaultURLHandler.m
+++ b/CopyMailto/DefaultURLHandler.m
@@ -10,6 +10,19 @@
@implementation DefaultURLHandler
++ (OSStatus)setDefaultURLHandler {
+ CFStringRef scheme = (CFStringRef)@"mailto";
+ CFStringRef bundle_identifier = (__bridge CFStringRef)[[NSBundle mainBundle] bundleIdentifier];
+ NSLog(@"%@", bundle_identifier);
+
+ OSStatus status = LSSetDefaultHandlerForURLScheme(scheme, bundle_identifier);
+ NSLog(@"%d", status);
+
+ CFRelease(scheme);
+
+ return status;
+}
+
+ (void)saveDefaultURLHandler {
CFStringRef mailto = (CFStringRef)@"mailto";
CFStringRef bundle_identifier = LSCopyDefaultHandlerForURLScheme(mailto);