react-native-webview
react-native-webview copied to clipboard
NSInvalidArgumentException: -[RNCWebViewImpl destroyWebView]: unrecognized selector sent to instance 0x10b1e9a00
Hello, i get this error when i navigate back from the webview screen
""""""""""""""" NSInvalidArgumentException: -[RNCWebViewImpl destroyWebView]: unrecognized selector sent to instance 0x10b1e9a00 """""""""""""""
The app crashes automatically. Thanks
OS: iOS Simulator on MacOS
OS version: iOS Simulator 17.2 on Sonoma 14.2.1
Xcode version: Version 15.1 (15C65)
react-native version: 0.73.2
react-native-webview version: 13.6.4
Full error:
[CoreFoundation] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RNCWebViewImpl destroyWebView]: unrecognized
selector sent to instance 0x11d38d400'
*** First throw call stack:
(
0 CoreFoundation 0x0000000180491128 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018008412c objc_exception_throw + 56
2 CoreFoundation 0x00000001804a5f78 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 UIKitCore 0x000000018531b6e0 -[UIResponder doesNotRecognizeSelector:] + 232
4 STAT 0x0000000101f82dec -[RNCWebViewImpl forwardInvocation:] + 220
5 CoreFoundation 0x0000000180495054 ___forwarding___ + 732
6 CoreFoundation 0x000000018049759c _CF_forwarding_prep_0 + 92
7 STAT 0x0000000101f6a500 -[RNCWebView prepareForRecycle] + 80
8 STAT <…>
Encountered on an Expo Prebuild (aka bare/ejected) app when navigating away from a stack screen with the webview, as rendered by react-native-autoheight-webview (1.6.5) right after turning on the new architecture to test that in the app.
Can provide a minimal repro if wanted.
+1 For me, it is IOS only when the new arch is turned on I have react-native: 0.73.2 react-native-webview: 13.6.4 react-native-screens: 3.29.0 @react-navigation/native: 6.1.9 @react-navigation/native-stack: 6.9.17
So, the crash happens when I navigate away from WebView screen, it can be either navigation.goBack(), or just using the swipe to the right gesture on IOS. FYI, I was able to fix it by downgrading the react-native-webview to 13.6.3 BUT in that case pod install(with new arch) were failing and I had to add the following command to my profile post-install script:
installer.pods_project.targets.each do |target|
if target.name === "react-native-webview"
append_header_search_path(target, "${PODS_ROOT}/Headers/Private/Yoga")
end
end
and define this append_header_search_path function globally on the top of podfile
def append_header_search_path(target, path)
target.build_configurations.each do |config|
# Note that there's a space character after `$(inherited)`.
config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
config.build_settings["HEADER_SEARCH_PATHS"] << path
end
end
and that's it. it fixes this crash for me.
Same problem for me - when you navigate to a previous screen it crashes. Happens only on iOS with new architecture enabled.
My stack is: @react-navigation/native: 6.1.7 @react-navigation/native-stack: 6.9.13 react-native-in-app-review: "4.3.3 react-native-screens: 3.29.0 react-native-webview: 13.7.0
Unfortunately I couldn't get 13.6.3 to install with the above fix.
Same problem for me - when you navigate to a previous screen it crashes. Happens only on iOS with new architecture enabled.
My stack is: @react-navigation/native: 6.1.7 @react-navigation/native-stack: 6.9.13 react-native-in-app-review: "4.3.3 react-native-screens: 3.29.0 react-native-webview: 13.7.0
Unfortunately I couldn't get 13.6.3 to install with the above fix.
what is the RN version you have? and did you get the error during pod install or the build phase?
Woops! I'm using RN 0.73.2. When I use react-native-webview 13.6.3 then pod install is fine, but it fails to build.
All, facing similar issue tried above pod file changes but it still app crashes. Do we have any alternate approach here? Please suggest. It works good in simulator but fails badly in both iPhone/iPad.
I'm getting this issue. In my simulator works fine, but in testflight version the application breaks when the component is unmounting. The new arch is enabled
Hi there! I'm Riccardo, from the React Native core team.
Thank you so much for raising this issue. The problem should not be addressed in WebView as this issue revealed a broader problem in React Native Core. We are going to fix it there with this pr. Main is already fixed.
RN 0.73.5 fixed this for me. Thanks @cipolleschi 😄
unfortunately, this fix has not yet been ported to the 0.72 yet :cry:
My bad... I forgot to request the pick for 0.72. :(
I created a PR https://github.com/facebook/react-native/pull/43240 against 0.72, hopefully still in time to be merged before the release...
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically