Post

Replies

Boosts

Views

Created

wkwebview.navigationdelegate is still nil after assigned delegate
I assign its navigationDelegate in my 'CustomWebView' init function, the init function is called in the viewDidLoad function and the 'CustomWebView' implements the WKNavigationDelegate functions, objection_requires(NSStringFromSelector(@selector(configRepository))) - (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration configRepository:(SKYConfigRepository *)configRepository { self = [super init]; _configRepository = configRepository; if (self) { [[JSObjection defaultInjector] injectDependencies:self]; self.converterLink = [JSObjection defaultInjector][@protocol(UniversalLinkConverterProtocol)]; WKWebViewConfiguration *wkWebViewConfig = [self getWebViewConfigWithUpdatedUserAgent:configuration]; _wkWebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:wkWebViewConfig]; _wkWebView.navigationDelegate = self; ... ... then when I debug the '_wkWebView.navigationDelegate' is nil the 'self' is not nil, and it implements the WKNavigationDelegate, {   WKWebView *_wkWebView;   SKYConfigRepository *_configRepository; }
3
0
1.7k
Nov ’22