RCTBatchedBridge.m Error: Invalid data message - everything must be length:% zd. React Native, iOS Simulator

I use react-native-oauth and get this error (see red image below) when trying to log in. I searched and found only this similar unanswered question . I looked at the source and found where the error was raised on line 954, and it looks like moduleIDs.count should equal methodIDs.count and paramsArrays.count :

  if (RCT_DEBUG && (moduleIDs.count != methodIDs.count || moduleIDs.count != paramsArrays.count)) { RCTLogError(@"Invalid data message - all must be length: %zd", moduleIDs.count); 

So, still in the source , I search for these objects and find them defined a little higher, on lines 943-945, and they use RCTConvert, whose functions "... everyone takes a JSON value as input and matches it with a native type or class Objective-C ". - React docs

So it looks like this is a transmission related and / or network error. But I have basically 0 knowledge in these areas, and I feel like I’m in a hurdle to investigate and wondered if anyone has any ideas to move forward. Being new to React Native and never doing any Objective-C can't help me.

Also, here my code generates errors.

 import OAuthManager from 'react-native-oauth'; import { Alert } from 'react-native' var env = require('../environment.js') const config = { facebook: { client_id: env.getKey("FB_ID"), client_Secret: env.getKey("FB_SECRET") } } const manager = new OAuthManager('myAppName') manager.configure(config); exports.authWithFb = () => { manager.authorize('facebook') .then(resp => Alert.alert('response!' + resp)) .catch(err => Alert.alert('error msg here: ' + err)); } 

I assume that this undefined error is related to the RCTBridge error, but not sure. You can see when I warn of the manager.authorize error. TypeError: undefined is not an object (evaluating 'fn') :

enter image description here this error

Edit:

When I try to notify the config object, I get a message that there is no way to reinforce it with a sub-object. enter image description here

When you view the console in the chrome debugger, I get “Can't read the configureProvider property from undefined” and configureProvider() is what react-native-oauth , so it looks like the manager is not configured correctly, so, maybe i did well link the library. Check if the link works.

Im delving into errors a bit, and this seems like a promise / callback problem from NativeModules.OAuthManager . Accuracy: TypeError: Cannot read property 'authorize' of undefined . When I go into the stack trace, I find: enter image description here

Any help is much appreciated, thanks.

+2
source share
2 answers

So, for me, all that was wrong was the installation problem with react-native-oauth , because everything was fixed, since I returned to the point where my code had no other dependencies (I also had Firestack) and configured from scratching again, following reactions related to reaction-native-oauth. I realized that there was a step on the iOS / Xcode side that I skipped because when I initially tried, I could not find the file, so I just skipped this step:

From reaction-native-oauth readme

Then go to the next section, “Assembling phases” of the project parameters, find “Linking to the binary library”, expand it and click “+” to add libOAuthManager.a to the list.

The errors I received were removed from a few steps, but I am sure that it is somehow connected. Lessons learned: Do not try to do too many things at once and do not skip the necessary steps.

+2
source

You will get this error when you send the wrong data to your home side. For example, if you must pass a string, but you pass an object.

Please console.log enter the config variable.

https://www.npmjs.com/package/react-native-oauth

I think you sent the wrong data to your home side.

+1
source

Source: https://habr.com/ru/post/1012790/


All Articles