From 31ee954a50a472fb013707eed088cfc6ebd56c38 Mon Sep 17 00:00:00 2001 From: radj Date: Thu, 10 Dec 2015 22:39:35 +0800 Subject: [PATCH 1/4] Attempt to open with UIApplication openURL: --- Makefile | 1 + control | 2 +- open.m | 6 ++++++ theos | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) mode change 160000 => 120000 theos diff --git a/Makefile b/Makefile index 2ff51b3..d7a691a 100644 --- a/Makefile +++ b/Makefile @@ -7,5 +7,6 @@ TOOL_NAME = open open_FILES = open.m open_PRIVATE_FRAMEWORKS = SpringBoardServices open_CODESIGN_FLAGS = -SEntitlements.plist +open_FRAMEWORKS = UIKit include $(THEOS_MAKE_PATH)/tool.mk diff --git a/control b/control index d0da013..c3dc8a3 100644 --- a/control +++ b/control @@ -1,5 +1,5 @@ Package: com.conradkramer.open -Version: 1.1.1 +Version: 1.1.2 Architecture: iphoneos-arm Maintainer: BigBoss Author: Conrad Kramer diff --git a/open.m b/open.m index bb2b139..67d5a87 100644 --- a/open.m +++ b/open.m @@ -1,5 +1,6 @@ #include #include +#include #ifndef SPRINGBOARDSERVICES_H_ extern int SBSLaunchApplicationWithIdentifier(CFStringRef identifier, Boolean suspended); @@ -25,6 +26,11 @@ int main(int argc, char **argv, char **envp) CFShow(SBSApplicationLaunchingErrorString(ret)); } + NSURL *url = [NSURL URLWithString:(NSString*)identifier]; + if (![[UIApplication sharedApplication] openURL:url]) { + fprintf(stderr, "openURL %s also failed.\n", [[url absoluteString] UTF8String]); + } + CFRelease(identifier); return ret; diff --git a/theos b/theos deleted file mode 160000 index a05354a..0000000 --- a/theos +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a05354a7b9839a5dce48f7c07114f30dd195b537 diff --git a/theos b/theos new file mode 120000 index 0000000..e30945d --- /dev/null +++ b/theos @@ -0,0 +1 @@ +/opt/theos \ No newline at end of file From 6ec55de6768545dde21d0160ba9401599298eb97 Mon Sep 17 00:00:00 2001 From: radj Date: Fri, 11 Dec 2015 12:58:25 +0800 Subject: [PATCH 2/4] Use MobileCoreServices/LSApplicationWorkspace instead of UIApplication --- Makefile | 2 +- open.m | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d7a691a..83d4da2 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ include theos/makefiles/common.mk TOOL_NAME = open open_FILES = open.m -open_PRIVATE_FRAMEWORKS = SpringBoardServices +open_PRIVATE_FRAMEWORKS = SpringBoardServices MobileCoreServices open_CODESIGN_FLAGS = -SEntitlements.plist open_FRAMEWORKS = UIKit diff --git a/open.m b/open.m index 67d5a87..2c7794b 100644 --- a/open.m +++ b/open.m @@ -1,6 +1,7 @@ #include #include #include +#include #ifndef SPRINGBOARDSERVICES_H_ extern int SBSLaunchApplicationWithIdentifier(CFStringRef identifier, Boolean suspended); @@ -24,11 +25,11 @@ int main(int argc, char **argv, char **envp) if (ret != 0) { fprintf(stderr, "Couldn't open application: %s. Reason: %i, ", argv[1], ret); CFShow(SBSApplicationLaunchingErrorString(ret)); - } - NSURL *url = [NSURL URLWithString:(NSString*)identifier]; - if (![[UIApplication sharedApplication] openURL:url]) { - fprintf(stderr, "openURL %s also failed.\n", [[url absoluteString] UTF8String]); + NSURL *url = [NSURL URLWithString:(NSString*)identifier]; + if (![[LSApplicationWorkspace defaultWorkspace] openURL:url]) { + fprintf(stderr, "openURL %s also failed.\n", [[url absoluteString] UTF8String]); + } } CFRelease(identifier); From 03dffff6a1d4ad53d8f4678d0f292610619c18ba Mon Sep 17 00:00:00 2001 From: radj Date: Fri, 11 Dec 2015 13:01:33 +0800 Subject: [PATCH 3/4] Return success code zero if successful with openURL --- open.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/open.m b/open.m index 2c7794b..a9c392d 100644 --- a/open.m +++ b/open.m @@ -29,6 +29,8 @@ int main(int argc, char **argv, char **envp) NSURL *url = [NSURL URLWithString:(NSString*)identifier]; if (![[LSApplicationWorkspace defaultWorkspace] openURL:url]) { fprintf(stderr, "openURL %s also failed.\n", [[url absoluteString] UTF8String]); + } else { + ret = 0; } } From ba34d343484f9f39ffd6e3bf088eb689ee87cb5e Mon Sep 17 00:00:00 2001 From: radj Date: Fri, 11 Dec 2015 13:02:37 +0800 Subject: [PATCH 4/4] Minor cleanup --- open.m | 1 - 1 file changed, 1 deletion(-) diff --git a/open.m b/open.m index a9c392d..860b8f2 100644 --- a/open.m +++ b/open.m @@ -1,6 +1,5 @@ #include #include -#include #include #ifndef SPRINGBOARDSERVICES_H_