可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.