1

I have a custom wkwebView called SSWkWebView. And I have two viewControllers (A & B) . [self.view addsubview: SSWkWebView] When I pop B VC to A VC , crash happened. And crash only happens on ios 8 and ios 9, but not with ios 10.

Log info: objc[31702]: Cannot form weak reference to instance (0x7ffe21182c00) of class NSKVONotifying_SSWKWebView. It is possible that this object was over-released, or is in the process of deallocation.

I have done some research, here is the link : Login flow failing after upgrading to iOS9 which seems not working. Then I tried another approach that adding the following code:

- (void)dealloc {
wkWebView.scrollView.delegate = nil;
}

and it does not work too.

In addition, I did't refer weakSelf in dealloc function. It's been annoying me for decades. Please help and thanks in advance!

Manos Nikolaidis
  • 21,608
  • 12
  • 74
  • 82
Johnic
  • 11
  • 1

1 Answers1

1

For ObjC,

- (void)didMoveToSuperview {
    if (self.superview == nil) {
        self.scrollView.delegate = nil;
    }
}

https://stackoverflow.com/a/52046816/443530

akshay1188
  • 1,647
  • 2
  • 17
  • 35