Instabug / Instabug-iOS

In-app feedback and bug reporting tool for apps.
https://instabug.com/
Other
290 stars 67 forks source link

Exception - [NSNull length] unrecognized selector #304

Closed Eladossa closed 5 years ago

Eladossa commented 5 years ago

I'm new at React Native, I apologize in advance. Sometimes, but not everytime when the app is loaded for the first time and the main screen is showen, I get this error -

Exception '-[NSNull length]: unrecognized selector sent to instance 0x1e6c059b0' was thrown while invoking multiSet on target AsyncLocalStorage with params ( ( ( "@Ye-Music:songs", "null" )
this is the screenshot - https://ibb.co/JtWzYKV

The function that made the error - `async componentDidMount() {

 await this.allSongs();

}

allSongs = () => { console.log("allSongs function begin!"); fetch(URL + "/SongsList", { body: null, method: "POST", headers: { Accept: "application/json", "Content-type": "application/json; charset=UTF-8" } }) .then(res => { return res.json(); }) .then(songsResult => { AsyncStorage.setItem("@Ye-Music:songs", songsResult.d); }) .catch(err => { console.error(err); }); }; `

Can anyone please tell me why is this erorr happening and how should I fix it?

Kmohamed commented 5 years ago

Hello @dosaSpace, First, please do not post any questions that do not relate to Instabug. you can use something like StackOverflow. Second, you are passing null to the body please remove it and add empty Dictionary.

Eladossa commented 5 years ago

@Kmohamed it's not a null that i'm passing, its a json object.

Kmohamed commented 5 years ago

Could you try to pass empty object {}?

Eladossa commented 5 years ago

@Kmohamed nope, that imposible. This is the object I'm trying to pass - http://ruppinmobile.tempdomain.co.il/site15/WebService.asmx/SongsList

Kmohamed commented 5 years ago

If you are trying to fetch the content of the file. So why you are using a POST request you should use a GET request.

Eladossa commented 5 years ago

@Kmohamed I get now the same error , now every time after the app is loaded for the first time.

Kmohamed commented 5 years ago

You should remove the body from the request.

Eladossa commented 5 years ago

@Kmohamed o.k it's working good so far. but on the other function which is similar to this one (that I have on other screen) its has the same error.

Kmohamed commented 5 years ago

I think you may need to subscribe to Instabug for this kind of support. 🤔

Eladossa commented 5 years ago

o.k but it's very complected to explain the bug. it's happening only after I send with another function a new string and then fethc it back...

Kmohamed commented 5 years ago

Let’s move this conversation over email in order not to add unrelated questions on our public repo. Please email contactus@instabug.com and we could continue the conversation over there. Happy New Year 💥🎉

Eladossa commented 5 years ago

@Kmohamed o.k ill will send an email for you now, thanks