去掉Safari网页中的广告,于是,找了一个10系统的机器,日志显示,己经HOOK成功,但是广告图替换不掉,很诡异!!!!!!
代码如下:
%hook NSURL
+(id)URLWithString:(NSString *)URLString
{
NSString *TempURL=[URLString lowercaseString];
NSLog(@"---XXXYYY_8888:%@",TempURL);
if ([TempURL containsString:@"sina"])
{
NSLog(@"---XXXYYY_8888_REPLACE_OK");
return %orig(@"http://127.0.0.1/0.png");
}
return %orig;
}
+(id)URLWithString:(NSString *)URLString relativeToURL:(id)arg2
{
NSString *TempURL=[URLString lowercaseString];
NSLog(@"---XXXYYY_9999:%@",TempURL);
if ([TempURL containsString:@"sina"])
{
NSLog(@"---XXXYYY_9999_REPLACE_OK");
return %orig(@"http://127.0.0.1/0.png",arg2);
}
return %orig;
}
%end
日志如下:
com.apple.WebKit.Networking ---XXXYYY_8888:https://k.sinaimg.cn/n/news/transform/525/w315h210/20241123/2eb4-b430039e177b13b4c7a15bf330944cb2.jpg/w210h140z1l50t1q100f1699.jpg
com.apple.WebKit.Networking ---XXXYYY_8888_REPLACE_OK
com.apple.WebKit.Networking ---XXXYYY_9999:http://127.0.0.1/0.png
com.apple.WebKit.Networking ---XXXYYY_8888:https://k.sinaimg.cn/n/news/transform/525/w315h210/20241123/2eb4-b430039e177b13b4c7a15bf330944cb2.jpg/w210h140z1l50t1q100f1699.jpg
com.apple.WebKit.Networking ---XXXYYY_8888_REPLACE_OK
com.apple.WebKit.Networking ---XXXYYY_9999:http://127.0.0.1/0.png
各位老师,帮我找找原因,出在哪里呢?谢谢!
难道10系统,HOOK,Safari己经失效了吗?