UIApplication的@selector(openURL:) 方法失效,导致无法跳转
解决1:问题出现在Xcode16出的包中,换回Xcode15打包是正常的
解决2:查询三方是否适配,更新sdk插件
解决3:RunTime
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIApplication_Swizzle : UIApplication
@end
NS_ASSUME_NONNULL_END
#import "UIApplication+Swizzle.h"
@implementation UIApplication_Swizzle
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Method originalMethod = class_getInstanceMethod(self, @selector(openURL:));
Method swizzledMethod = class_getInstanceMethod(self, @selector(swizzled_openURL:));
method_exchangeImplementations(originalMethod, swizzledMethod);
});
}
- (void)swizzled_openURL:(NSURL *)url {
NSLog(@"Swizzled openURL: %@", url);
[self openURL:url options:@{} completionHandler:nil];
}
@end