Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined is not an object (evaluating 'RCTWebSockerManager.connect') -- React Native

I've been following the guide on how to integrate an existing app with react native.

I've taken some liberties on the IOS side of things per recommendation of our IOS guy. When my view loads, I get a red error screen with this stack trace.

(sorry, not enough reputation to post images. Text is included below. )

    2015-08-27 22:19:37.739 [error][tid:com.facebook.React.JavaScript] 'Warning: Native component for "RCTImageView" does not exist'
    2015-08-27 22:19:37.851 [info][tid:com.facebook.React.JavaScript] 'Running application "SimpleApp" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'
    2015-08-27 22:19:37.856 [error][tid:com.facebook.React.JavaScript] 'Error: undefined is not an object (evaluating \'RCTWebSocketManager.connect\')
     stack: 
      connectToSocketImpl  index.ios.bundle:14464
      WebSocketBase        index.ios.bundle:14587
      WebSocket            index.ios.bundle:14458
      setupDevtools        index.ios.bundle:46060
      renderApplication    index.ios.bundle:44403
      run                  index.ios.bundle:44295
      runApplication       index.ios.bundle:44323
      __callFunction       index.ios.bundle:5552
      <unknown>            index.ios.bundle:5488
      guard                index.ios.bundle:5441
      <unknown>            index.ios.bundle:5488
      <unknown>            index.ios.bundle:5485
      perform              index.ios.bundle:7033
      batchedUpdates       index.ios.bundle:16454
      batchedUpdates       index.ios.bundle:6336
      <unknown>            index.ios.bundle:5484
      guard                index.ios.bundle:5441
      processBatch         index.ios.bundle:5483
     URL: http://192.168.1.70:8081/index.ios.bundle
     line: 14464
     message: undefined is not an object (evaluating \'RCTWebSocketManager.connect\')'

Here is my Podfile:

    pod 'FBSDKShareKit'
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'React'
    pod 'React/RCTText'

("URL:" was changed to that manually rather than local host but responds the same in the browser.)

When I run:

(JS_DIR=`pwd`/ReactComponent; cd Pods/React; npm run start -- --root $JS_DIR)

Everything runs fine with a log yielding:

[22:32:15] <START> fs crawl
[22:32:16] <END>   fs crawl (744ms)
[22:32:16] <START> Building in-memory fs
[22:32:16] <END>   Building in-memory fs (454ms)
[22:32:16] <START> Building in-memory fs
[22:32:17] <END>   Building in-memory fs (242ms)
[22:32:17] <START> Building Haste Map
[22:32:17] <START> Building (deprecated) Asset Map
[22:32:17] <END>   Building (deprecated) Asset Map (75ms)
[22:32:17] <END>   Building Haste Map (836ms)

Once I start up the project in the xcode ios-simulator I get the aforementioned stacktrace. I can include my objective c code if it would be helpful but I omitted to prevent clutter as it seems like an issue with the react dependencies.

Thanks! Any help is appreciated.

like image 238
klvs Avatar asked Aug 28 '15 05:08

klvs


1 Answers

So I figured it out. If you're having this issue, fixing my podfile to this worked. Delete your Pods/ directory and then run pod install again with the following podfile. Restart the dev server for good measure too.

pod 'FBSDKShareKit' pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'React' pod 'React', :subspecs => [ 'RCTText', 'RCTImage', 'RCTNetwork', 'RCTWebSocket' ]

like image 114
klvs Avatar answered Nov 02 '22 16:11

klvs