感谢码友 我把Swift版本整理下 供码友参考 func hookOldOpenUrl(tragetCls:AnyClass){ let cls = UIApplication.self let originalSelector = #selector(UIApplication.openURL(_:)) let swizzledSelector = #selector(g_openURL) let originalMethod = class_getInstanceMethod(cls, originalSelector) let swizzledMethod = class_getInstanceMethod(tragetCls, swizzledSelector) let didAddMethod: Bool = class_addMethod(cls, originalSelector, method_getImplementation(swizzledMethod!), method_getTypeEncoding(swizzledMethod!)) if didAddMethod { class_replaceMethod(cls, swizzledSelector, method_getImplementation(originalMethod!), method_getTypeEncoding(originalMethod!)) } else { method_exchangeImplementations(originalMethod!, swizzledMethod!) } } @objc func g_openURL(url:URL)->Bool{ UIApplication.shared.open(url) return true }
iOS 18 WXApi sendReq 无法唤起微信[图片] iOS 18 WXApi sendReq 无法唤起微信 Xcode版本:Xcode 16 手机版本:iPhone12真机 系统: iOS18 报错信息:BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(_:) needs to migrate to the non-deprecated UIApplication.open(_:options:completionHandler:). Force returning false (NO).
10-15