3

I am having a strange issue, the app (iOS and Android) works fine when being used in a Simulator under Remote Debug mode.

However, when I turn the Remote Debug mode off for iOS development, I am unable to receive data back from the server. This is not the case with Android it works fine as expected outside Remote Debug mode.

Wonder what might the case with iOS when I turn the Remote Debug mode off?

I have also attached a screenshot of Network requests from iOS simulator if it is helpful in narrowing down the issue here.

iOS Screenshot

Taimoor Khan
  • 183
  • 1
  • 3
  • 17

3 Answers3

2

I had the same issue. If you are using Axios with Basic Authentication to make your HTTP requests, the problem is that btoa is not defined in React Native. It works only in debug mode.

React Native atob() / btoa() not working without remote JS debugging

https://github.com/facebook/react-native/issues/21892

casey
  • 33
  • 5
1

Solution:

I also had this issue, It just takes me 7 days to find the solution the solution is funny you have to just add '/' at the end of your API request

e.g www.domain.com/operation/staffOperations/rbl-3049OW09cfknpehop Add '/' at the end www.domain.com/operation/staffOperations/rbl-3049OW09cfknpehop/

It work for me, hope this work for you also

0

I was facing the exact same issue. However, I noticed that for some API calls, I passed dummy data as data: {} in the API request. Removing it worked for me

For instance -

// Api was an axios instance created using axios.create with a baseURL
Api({
   method: 'GET',
   url: '/test'
   // data: {}    <== Removing / commenting this worked for me
})

More information here - https://github.com/axios/axios/issues/2380

Note: My baseURL didn't have '/' in the end or the URL paths didn't have the '/' in the end. But, that wasn't an issue for me. I even tried with the the '/' as @Gulshan Prajapati pointed out, but it didn't help in my case.

Aswin Ramakrishnan
  • 3,195
  • 2
  • 41
  • 65