DEV Community

Yaşar İÇLİ
Yaşar İÇLİ

Posted on

How can we fix "UIWebView will no longer be accepted" ?

When I publish our React-native App, we get a warning like this.

The solution to this is to delete RCTWebView.

Let's solve this with Fastlane.

cd ios/fastlane/
touch fix-uiwebview.rb
Enter fullscreen mode Exit fullscreen mode

The file fix-webview.rb is saved as follows.

fix-webview.rb

require 'xcodeproj'

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
Enter fullscreen mode Exit fullscreen mode

then we open the Fastfile file and add the following to the bottom lane.

Fastfile


platform :ios do

  desc 'Deploy to AppStore'
  lane :release do
    fix_uiwebview
    upload_to_app_store
  end

  lane :beta do
    fix_uiwebview
    upload_to_testflight
  end

  desc "Fix deprecated UIWebView"
  private_lane :fix_uiwebview do
    sh("ruby", "fix-uiwebview.rb")
  end 

end
Enter fullscreen mode Exit fullscreen mode

Thanks.

Top comments (0)