Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKWebView swizzled -dealloc 崩溃 #5

Open
ocyisheng opened this issue Jun 27, 2018 · 2 comments
Open

WKWebView swizzled -dealloc 崩溃 #5

ocyisheng opened this issue Jun 27, 2018 · 2 comments

Comments

@ocyisheng
Copy link

  • (void)load
    {
    // BAKit_Objc_exchangeMethodAToB(NSSelectorFromString(@"init"), @selector(ba_web_init));
    // BAKit_Objc_exchangeMethodAToB(NSSelectorFromString(@"initWithFrame"), @selector(ba_web_initWithFrame));
    BAKit_Objc_exchangeMethodAToB(NSSelectorFromString(@"dealloc"),
    @selector(ba_web_dealloc));

}

  • (void)ba_web_dealloc
    {
    //1.这里需要判断是否已经添加了observe
    if(hadAddObserve){
    [self ba_removeNoti];
    }
    //2.在之后应该调用ba_web_dealloc
    [self ba_web_dealloc];
    }
@lwq1365102044
Copy link

解决了吗?

@ocyisheng
Copy link
Author

解决了吗?

需要判断观察者是否存在,再移除就没事了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants