Error: undefined is not an object (evaluating \\'RCTWebSocketManager.connect\\')

匿名 (未验证) 提交于 2019-12-03 08:44:33

问题:

I m using React-native v0.10.0 and getting this screen:

Ok, So I figure out I m doing something wrong.

So I downloaded the code from this official React-native website for integrating React-native into existing app using pod.

The downloaded code uses React-native v0.2.1 and everything looks good there. So I copied the whole code and overrode mine, but the red screen still appears. It left me just with the changes of the React-native

Is there any chance that the current version of React-native v0.10.1 doesn't work at all? :/

Thanks in advance!

回答1:

I've had success by adding pod 'React/RCTWebSocket' to the Podfile as well and running pod install again.



回答2:

This issue is caused because RCTWebSocketManager is not defined in your bundled app. The connect method of an object cannot be called on an undefined or null object.

To resolve this problem in iOS open Build Phases for your app target and ensure libRCTWebSocket.a exists in the Link Binary with Libraries section. If the item is not listed and not available for addition then add RCTWebSocket.xcodeproj to your app's Libraries folder in Xcode and try linking again.



回答3:

This may seem rather trivial, but check to make sure that you have deleted react-native from the node_modules directory within the directory of react-native-router in the app's node_modules directory. If react-native is listed again the app will throw an error.

I have experienced this issue on a couple of occasions and this has been the cause for the error.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!