关于iOS15.7 iOS16.0 [SKStoreProduc

2022-09-19  本文已影响0人  白马青衫少年郎0

1.点击广告,打开app stroe下载页面,杀死app触发
2.加载或者展示出广告,杀死app也可能触发

解决办法:写个类别,弄个钩子

#import "SKStoreProductViewController+CSJAd.h"
#import <objc/runtime.h>


@implementation SKStoreProductViewController (CSJAd)

+ (void)load {
    NSString *selName = @"";
    SEL sel;
    
    selName = @"sceneDisconnected:";
    sel = NSSelectorFromString(selName);
    Method method1 = class_getInstanceMethod([self class], sel);
    if (method1 == nil) {
        class_addMethod([self class], sel, (IMP)csj_custom_sceneDisconnected, "v@:@");
    }
    
    selName = @"appWillTerminate";
    sel = NSSelectorFromString(selName);
    Method method2 = class_getInstanceMethod([self class], sel);
    if (method2 == nil) {
        class_addMethod([self class], sel, (IMP)csj_custom_appWillTerminate, "v@");
    }
}

void csj_custom_sceneDisconnected(id self, SEL _cmd, id params) {
    // DoNothing
}

void csj_custom_appWillTerminate(id self, SEL _cmd) {
    // DoNothing
}

@end
上一篇 下一篇

猜你喜欢

热点阅读