Open kirb opened 8 years ago
oh nice. I'll change to that way directly in ActivityAction(I'm using this for it).
BTW, runtime automatically link to MobileCoreServices.framework launch timing even if app developer not link to it?
UIKit links against MobileCoreServices:
$ otool -L ~/sdks/sim/iPhoneSimulator9.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit | grep mobilecoreservices -
grep: warning: recursive search of stdin
(standard input):29: /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 727.5.3)
Wow gotcha! Thanks for quick reply.
Yep this package isn't needed, this worked for me inside my tweak:
@interface LSApplicationWorkspace
- (BOOL)isApplicationAvailableToOpenURL:(id)arg1 error:(id*)arg2;
@end
static IMP original_LSApplicationWorkspace_isApplicationAvailableToOpenURL_error;
static BOOL replaced_LSApplicationWorkspace_isApplicationAvailableToOpenURL_error(LSApplicationWorkspace* self, SEL sel, NSError** error){
return YES; // allows all URLs.
}
...
Class $LSApplicationWorkspace(objc_getClass("LSApplicationWorkspace"));
MSHookMessageEx($LSApplicationWorkspace, @selector(isApplicationAvailableToOpenURL:error:), (IMP)replaced_LSApplicationWorkspace_isApplicationAvailableToOpenURL_error,& original_LSApplicationWorkspace_isApplicationAvailableToOpenURL_error);
This seems necessary on iOS 11 now. Pretty much all of LSApplicationWorkspace, LSApplicationProxy, etc. is restricted.
When they restrict something sometimes there is an entitlement that can enable it again.
The restrictions are implemented within
-[LSApplicationWorkspace isApplicationAvailableToOpenURL:error:]
, which otherwise just calls[LSApplicationWorkspace applicationsAvailableForHandlingURLScheme:]
and returns YES if there's at least one result.