File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
iOS_SDK/OneSignalSDK/Source Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,17 @@ - (void)setupWebviewWithMessageHandler:(id<WKScriptMessageHandler>)handler {
111111 self.webView .backgroundColor = [UIColor clearColor ];
112112 self.webView .opaque = NO ;
113113 // https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/
114- if (@available (macOS 13.3 , iOS 16.4 , *) && [OneSignalLog getLogLevel ] >= ONE_S_LL_DEBUG) {
115- self.webView .inspectable = YES ;
114+ if (@available (macOS 13.3 , iOS 16.4 , *)) {
115+ if ([OneSignalLog getLogLevel ] >= ONE_S_LL_DEBUG) {
116+ if ([self .webView respondsToSelector: @selector (setInspectable: )]) {
117+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: [self .webView methodSignatureForSelector: @selector (setInspectable: )]];
118+ BOOL value = YES ; // Boolean parameters must be captured as a variable before being set as an argument
119+ [invocation setTarget: self .webView];
120+ [invocation setSelector: @selector (setInspectable: )];
121+ [invocation setArgument: &value atIndex: 2 ];
122+ [invocation invoke ];
123+ }
124+ }
116125 }
117126 [self addSubview: self .webView];
118127
Original file line number Diff line number Diff line change @@ -42,8 +42,17 @@ - (void)viewDidLoad {
4242 _webView = [WKWebView new ];
4343 _webView.navigationDelegate = self;
4444 // https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/
45- if (@available (macOS 13.3 , iOS 16.4 , *) && [OneSignalLog getLogLevel ] >= ONE_S_LL_DEBUG) {
46- _webView.inspectable = YES ;
45+ if (@available (macOS 13.3 , iOS 16.4 , *)) {
46+ if ([OneSignalLog getLogLevel ] >= ONE_S_LL_DEBUG) {
47+ if ([_webView respondsToSelector: @selector (setInspectable: )]) {
48+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: [_webView methodSignatureForSelector: @selector (setInspectable: )]];
49+ BOOL value = YES ; // Boolean parameters must be captured as a variable before being set as an argument
50+ [invocation setTarget: _webView];
51+ [invocation setSelector: @selector (setInspectable: )];
52+ [invocation setArgument: &value atIndex: 2 ];
53+ [invocation invoke ];
54+ }
55+ }
4756 }
4857 [self .view addSubview: _webView];
4958
You can’t perform that action at this time.
0 commit comments