Results 1 issues of kangfei

测试发现,会抛NSException异常,崩溃原因为:-[AppDelegate ytxmodule_ytxmodule_applicationWillEnterForeground:]: unrecognized selector sent to instance 0x283d09960 调用栈。崩溃堆栈如下: ![截屏2021-08-31 下午3 51 25](https://user-images.githubusercontent.com/12065604/131464421-731b606e-ff61-4e77-bf04-567d6c2aa7cb.png) 分析原因如下:应用没有实现切回前台的delegate方法applicationWillEnterForeground:,YTXModule先hook,实现逻辑是添加一个applicationWillEnterForeground:方法,实现为YTXModule的实现。同时再添加一个ytxmodule_前缀的实现,与YTXModule给Appdelegate类添加applicationWillEnterForeground:的实现一样。当触发切前台的操作时,会进入YTXModule的实现里,YTXModule会判断appdelegate的applicationWillEnterForeground:实现是否与自己的实现一样 ,如果一样就不会回调了。如图: ![截屏2021-08-31 下午3 59 36](https://user-images.githubusercontent.com/12065604/131466154-2ee2a976-6689-491f-bf18-feb89a9d8e52.png) 如果别人也hook了,则appdelegate的applicationWillEnterForeground:实现与自己的实现不一致了,会继续回调。回调appdelegate的ytxmodule_applicationWillEnterForeground:方法。导致又进入该方法。再次添加前缀,再调用会出现该崩溃。 该hook方式可能会有两种问题,其一是上面说的。其二别人hook时如果不修改传递的seletor参数(去掉自己的前缀)同样会有崩溃。