After removing the RCTWebView from react.xcodeproj again it adding in the project auomatically

1.4k Views Asked by At

I got a deprecated error while uploading the build to testflight, because of the UIWebView.

So I have removed the RCTWebView.m, RCTWebView.h, RCTWebViewManager.m, RCTWebViewManager.h and then I not found the UIWebview for some time.

But here again it get added in my Libraries under React.Xcodeproj. How can I remove this entirely?

2

There are 2 best solutions below

1
On

You deleted the files from a library you are including. When you perform the activity that installs the library again it will replace the one you changed with the version specified by your build. To fix permanently you need to speicfy a version of the react library that does not have these files

0
On

If you have Cocoapods in your project, you could add a post_install script in your Podfile.

The post_install script would be something like this:

react_project = Xcodeproj::Project.open("../node_modules/react-native/React/React.xcodeproj")
    react_project.main_group["React/Views"].files.each do |file|   
      if file.path.match(/^RCTWebView/) 
        file.remove_from_project
      end   
    end   
react_project.save

Your node_modules directory might be different from the code I posted above, so you might want to update it.

The code above tries to remove any header (.h) or class implementation (.m) files that contain RCTWebView after pod installation

Ref: https://github.com/facebook/react-native/issues/26255#issuecomment-528275747