小程序
小游戏
企业微信
微信支付
扫描小程序码分享
iOS 18微信分享分享不出去 ?没有唤醒微信?
5 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
- (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } [AppDelegate hookOldOpenUrl:AppDelegate.class];
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
在你的appdelegate中,添加以下代码: - (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } 在appdelegate的方法 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中添加: [AppDelegate hookOldOpenUrl:AppDelegate.class];
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
- (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } [AppDelegate hookOldOpenUrl:AppDelegate.class];
- (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } [AppDelegate hookOldOpenUrl:AppDelegate.class];
在你的appdelegate中,添加以下代码: - (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } 在appdelegate的方法 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中添加: [AppDelegate hookOldOpenUrl:AppDelegate.class];
在你的appdelegate中,添加以下代码: - (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } 在appdelegate的方法 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中添加: [AppDelegate hookOldOpenUrl:AppDelegate.class];
在你的appdelegate中,添加以下代码: - (BOOL)g_openURL:(NSURL*)url { [UIApplication.sharedApplication openURL:url options:nil completionHandler:nil]; return YES; } + (void)hookOldOpenUrl:(Class)targetCls { Class cls = [UIApplication class]; if (cls) { Method originalMethod =class_getInstanceMethod(cls, @selector(openURL:)); Method swizzledMethod =class_getInstanceMethod(targetCls, @selector(g_openURL:)); if (!originalMethod || !swizzledMethod) { return; } IMP originalIMP = method_getImplementation(originalMethod); IMP swizzledIMP = method_getImplementation(swizzledMethod); const char *originalType = method_getTypeEncoding(originalMethod); const char *swizzledType = method_getTypeEncoding(swizzledMethod); class_replaceMethod(cls,@selector(openURL:),swizzledIMP,swizzledType); class_replaceMethod(cls,@selector(g_openURL:),originalIMP,originalType); } } 在appdelegate的方法 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中添加: [AppDelegate hookOldOpenUrl:AppDelegate.class];