feat: 解决了微信无法登录的问题
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#import "JANALYTICSService.h"
|
#import "JANALYTICSService.h"
|
||||||
#import "XianliaoApiManager.h"
|
#import "XianliaoApiManager.h"
|
||||||
#import "QQShareManager.h"
|
#import "QQShareManager.h"
|
||||||
|
#import <objc/runtime.h>
|
||||||
@interface AppDelegate ()<BuglyDelegate>
|
@interface AppDelegate ()<BuglyDelegate>
|
||||||
{
|
{
|
||||||
BOOL flag;
|
BOOL flag;
|
||||||
@@ -397,3 +398,43 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface UIApplication (FixOpenURL)
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation UIApplication (FixOpenURL)
|
||||||
|
|
||||||
|
+ (void)load {
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
if (@available(iOS 10.0, *)) {
|
||||||
|
Class class = [self class];
|
||||||
|
|
||||||
|
SEL originalSelector = @selector(openURL:);
|
||||||
|
SEL swizzledSelector = @selector(fixed_openURL:);
|
||||||
|
|
||||||
|
Method originalMethod = class_getInstanceMethod(class, originalSelector);
|
||||||
|
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
|
||||||
|
|
||||||
|
if (class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) {
|
||||||
|
class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
|
||||||
|
} else {
|
||||||
|
method_exchangeImplementations(originalMethod, swizzledMethod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)fixed_openURL:(NSURL*)url {
|
||||||
|
if (@available(iOS 10.0, *)) {
|
||||||
|
if ([self canOpenURL:url]) {
|
||||||
|
[self openURL:url options:@{} completionHandler:nil];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
} else {
|
||||||
|
return [self fixed_openURL:url];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user