使用runtime 方法交換openurl
#import "UIApplication+ISJOpenUrl.h"
#import <NSObject+YYAdd.h>
@implementation UIApplication (ISJOpenUrl)
+ (void)load
{
[self swizzleInstanceMethod:@selector(openURL:) with:@selector(isj_openURL:)];
[self swizzleInstanceMethod:@selector(openURL:options:completionHandler:) with:@selector(isj_openURL:options:completionHandler:)];
}
- (void)isj_openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey,id> *)options completionHandler:(void (^)(BOOL))completion {
[self isj_openURL:url options:options completionHandler:completion];
}
- (BOOL)isj_openURL:(NSURL *)url {
return [self isj_openURL:url];
}
@end