]> git.saurik.com Git - uikittools.git/blobdiff - uiopen.mm
Port to Xcode 4.6.3: newer versions of Xcode fail.
[uikittools.git] / uiopen.mm
index 213a8c5ed8246f0e8ce3af48fe0cd2bae4aedf4b..46166c21f40efadd6934e96f958fc30e08ca7789 100644 (file)
--- a/uiopen.mm
+++ b/uiopen.mm
 
 #import <UIKit/UIKit.h>
 #include <stdio.h>
+#include <dlfcn.h>
 
 int main(int argc, char *argv[]) {
-    if (argc != 2)
+    if (argc != 2) {
         fprintf(stderr, "usage: %s <url>\n", argv[0]);
-    else {
-        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-        [[UIApplication alloc] openURL:[NSURL URLWithString:[NSString stringWithUTF8String:argv[1]]]];
-        [pool release];
+        return 1;
     }
 
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+    NSURL *url([NSURL URLWithString:[NSString stringWithUTF8String:argv[1]]]);
+
+    if (void (*SBSOpenSensitiveURLAndUnlock)(NSURL *, BOOL) = (void (*)(NSURL *, BOOL)) dlsym(RTLD_DEFAULT, "SBSOpenSensitiveURLAndUnlock"))
+        (*SBSOpenSensitiveURLAndUnlock)(url, YES);
+    else
+        [[UIApplication alloc] openURL:url];
+
+    [pool release];
     return 0;
 }