Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
[mobilecoreservices] make sure we override the newer method on iOS 10
Browse files Browse the repository at this point in the history
kirb committed May 29, 2017
1 parent 1f63d7b commit dd5ee82
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions MobileCoreServices.x
Original file line number Diff line number Diff line change
@@ -46,10 +46,19 @@ BOOL isOverriding = NO;
return newURL ?: %orig;
}

%group PreSchiller
- (BOOL)openURL:(NSURL *)url withOptions:(NSDictionary *)options {
// need to make sure all openURL: requests go through URLOverrideForURL:
return %orig([self _opener_URLOverrideForURL:url] ?: url, options);
}
%end

%group PhilSchiller
- (BOOL)openURL:(NSURL *)url withOptions:(NSDictionary *)options error:(NSError **)error {
// need to make sure all openURL: requests go through URLOverrideForURL:
return %orig([self _opener_URLOverrideForURL:url] ?: url, options, error);
}
%end

%end

@@ -61,5 +70,11 @@ BOOL isOverriding = NO;
// only load these hooks if we’re not in lsd, otherwise we crash in URLOverrideForURL: on iOS 10
if (![executableURL.path isEqualToString:@"/usr/libexec/lsd"]) {
%init;

if (IS_IOS_OR_NEWER(iOS_10_0)) {
%init(PhilSchiller);
} else {
%init(PreSchiller);
}
}
}

0 comments on commit dd5ee82

Please sign in to comment.