Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Using React Native Webview with React Native 0.37

$
0
0

I'm trying to install RN Webview as Apple is going to depreciate the existing WebView. I'm having some issues with the installation.

Note: Our project is on RN 0.37 and upgrading cannot be done immediately.

After installing and linking the library, when running we get several import issues.

#import <React/RCTViewManager.h> -> In RNCWebViewManager.h

'React/RCTViewManager.h' file not found

These were resolved by how we import the files.

#import <React/RCTViewManager.h> ->#import "RCTViewManager.h"

This was done for all imports that was imported from React.

After that, we're getting the following errors.

In file included from /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:8: /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:23:29: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] @property (nonatomic, weak) id scriptDelegate; ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:23:54: note: insert '_Nullable' if the pointer may be null @property (nonatomic, weak) id scriptDelegate; ^ _Nullable /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:23:54: note: insert '_Nonnull' if the pointer should never be null @property (nonatomic, weak) id scriptDelegate; ^ _Nonnull /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:24:4: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - (instancetype)initWithDelegate:(id)scriptDelegate; ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:24:4: note: insert '_Nullable' if the pointer may be null - (instancetype)initWithDelegate:(id)scriptDelegate; ^ _Nullable /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:24:4: note: insert '_Nonnull' if the pointer should never be null - (instancetype)initWithDelegate:(id)scriptDelegate; ^ _Nonnull /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:24:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness] - (instancetype)initWithDelegate:(id)scriptDelegate; ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:24:60: note: insert '_Nullable' if the pointer may be null - (instancetype)initWithDelegate:(id)scriptDelegate; ^ _Nullable /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:24:60: note: insert '_Nonnull' if the pointer should never be null - (instancetype)initWithDelegate:(id)scriptDelegate; ^ _Nonnull /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:108:3: warning: 'UIScrollViewContentInsetAdjustmentBehavior' is only available on iOS 11.0 or newer [-Wunguarded-availability-new]
UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior; ^ In module 'UIKit' imported from ../../react-native/React/Views/RCTView.h:12: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIScrollView.h:35:28: note: 'UIScrollViewContentInsetAdjustmentBehavior' has been marked as being introduced in iOS 11.0 here, but the deployment target is iOS 8.0.0 typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) { ^ In file included from /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:8: /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.h:27:12: note: annotate 'RNCWebView' with an availability attribute to silence this warning @interface RNCWebView : RCTView ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:394:44: warning: 'UIScrollViewContentInsetAdjustmentBehavior' is only available on iOS 11.0 or newer [-Wunguarded-availability-new] - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior ^ In module 'UIKit' imported from ../../react-native/React/Views/RCTView.h:12: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIScrollView.h:35:28: note: 'UIScrollViewContentInsetAdjustmentBehavior' has been marked as being introduced in iOS 11.0 here, but the deployment target is iOS 8.0.0 typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) { ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:394:1: note: annotate 'setContentInsetAdjustmentBehavior:' with an availability attribute to silence this warning - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:129:28: error: implicit declaration of function 'RCTSharedApplication' is invalid in C99 [-Werror,-Wimplicit-function-declaration] _savedStatusBarStyle = RCTSharedApplication().statusBarStyle; ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:129:50: error: member reference base type 'int' is not a structure or union _savedStatusBarStyle = RCTSharedApplication().statusBarStyle; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:130:51: error: member reference base type 'int' is not a structure or union _savedStatusBarHidden = RCTSharedApplication().statusBarHidden; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:138:44: warning: 'UIScrollViewContentInsetAdjustmentNever' is only available on iOS 11.0 or newer [-Wunguarded-availability-new] _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'UIKit' imported from ../../react-native/React/Views/RCTView.h:12: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIScrollView.h:35:28: note: 'UIScrollViewContentInsetAdjustmentBehavior' has been marked as being introduced in iOS 11.0 here, but the deployment target is iOS 8.0.0 typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) { ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:138:44: note: enclose 'UIScrollViewContentInsetAdjustmentNever' in an @available check to silence this warning _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:270:27: warning: 'setContentInsetAdjustmentBehavior:' is only available on iOS 11.0 or newer [-Wunguarded-availability-new] _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'UIKit' imported from ../../react-native/React/Views/RCTView.h:12: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIScrollView.h:68:65: note: 'setContentInsetAdjustmentBehavior:' has been marked as being introduced in iOS 11.0 here, but the deployment target is iOS 8.0.0 @property(nonatomic) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior API_AVAILABLE(ios(11.0),tvos(11.0)); ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:270:27: note: enclose 'setContentInsetAdjustmentBehavior:' in an @available check to silence this warning _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:308:5: error: implicit declaration of function 'RCTUnsafeExecuteOnMainQueueSync' is invalid in C99 [-Werror,-Wimplicit-function-declaration] RCTUnsafeExecuteOnMainQueueSync(^{ ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:309:8: error: implicit declaration of function 'RCTSharedApplication' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [RCTSharedApplication() setStatusBarStyle:UIStatusBarStyleLightContent animated:YES]; ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:309:8: error: bad receiver type 'int' [RCTSharedApplication() setStatusBarStyle:UIStatusBarStyleLightContent animated:YES]; ^~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:318:5: error: implicit declaration of function 'RCTUnsafeExecuteOnMainQueueSync' is invalid in C99 [-Werror,-Wimplicit-function-declaration] RCTUnsafeExecuteOnMainQueueSync(^{ ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:319:8: error: implicit declaration of function 'RCTSharedApplication' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES]; ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:319:8: error: bad receiver type 'int' [RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES]; ^~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:320:8: error: bad receiver type 'int' [RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES]; ^~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:403:29: warning: 'setContentInsetAdjustmentBehavior:' is only available on iOS 11.0 or newer [-Wunguarded-availability-new] _webView.scrollView.contentInsetAdjustmentBehavior = behavior; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In module 'UIKit' imported from ../../react-native/React/Views/RCTView.h:12: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIScrollView.h:68:65: note: 'setContentInsetAdjustmentBehavior:' has been marked as being introduced in iOS 11.0 here, but the deployment target is iOS 8.0.0 @property(nonatomic) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior API_AVAILABLE(ios(11.0),tvos(11.0)); ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:403:29: note: enclose 'setContentInsetAdjustmentBehavior:' in an @available check to silence this warning _webView.scrollView.contentInsetAdjustmentBehavior = behavior; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:684:5: error: implicit declaration of function 'RCTJSONStringify' is invalid in C99 [-Werror,-Wimplicit-function-declaration] RCTJSONStringify(eventInitDict, NULL) ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:684:5: warning: format specifies type 'id' but the argument has type 'int' [-Wformat] RCTJSONStringify(eventInitDict, NULL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1003:61: warning: '&&' within '||' [-Wlogical-op-parentheses] if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102 || [error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 101) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ ~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1003:61: note: place parentheses around the '&&' expression to silence this warning if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102 || [error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 101) { ^ ( ) /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1003:137: warning: '&&' within '||' [-Wlogical-op-parentheses] if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102 || [error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 101) { ~~

/Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1003:137:
note: place parentheses around the '&&' expression to silence this
warning
    if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102 || [error.domain
isEqualToString:@"WebKitErrorDomain"] && error.code == 101) {
                                                                                                                                        ^
                                                                                    (                                                                     
)
/Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1221:11:
error: implicit declaration of function 'RCTJSONStringify' is invalid
in C99 [-Werror,-Wimplicit-function-declaration]
          RCTJSONStringify(cookie.name, NULL),
          ^ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1221:11:
warning: format specifies type 'id' but the argument has type 'int'
[-Wformat]
          RCTJSONStringify(cookie.name, NULL),
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1222:11:
warning: format specifies type 'id' but the argument has type 'int'
[-Wformat]
          RCTJSONStringify(cookie.value, NULL)];
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/projects/myapp/test-webview/ios-app/node_modules/react-native-webview/ios/RNCWebView.m:1224:54:
warning: format specifies type 'id' but the argument has type 'int'
[-Wformat]
          [script appendFormat:@" + '; Path=' + %@", RCTJSONStringify(cookie.path, NULL)];
                                                ~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                %d 14 warnings and 12 errors generated.

How do we resolve this?

Environment:

  • OS: Mac
  • OS version: Catalina 10.15.3
  • react-native version: 0.37
  • react-native-webview version: 9.0.2

Viewing all articles
Browse latest Browse all 16552

Trending Articles