0

I am trying to called flask api from react native side using fetch,it works properly in android but it always give access denied when calling from ios. this is the api called from react native:

BackgroundTimer.runBackgroundTimer(() => {

fetch('http://192.168.1.9:8088/notification_view/api/read', { method: 'GET',

      // body: data,
    })
     .then(response => response.json())
     .then((res) => {
      console.log('response',res); 
      }).catch((e)=>{
      console.log(e)
       })
  }, 30000);

this api called in background every 30 seconds. api response: {"message": "Access is Denied", "severity": "danger"}

Dipali
  • 1
  • 3
  • Please share some minimal code to reproduce the error. – Rohit Aggarwal Mar 11 '21 at 13:57
  • thanks for your response i have change my question. – Dipali Mar 11 '21 at 15:51
  • This has nothing to do with react-native. May be the user you are using does not have read access and that's what your API response says. – Rohit Aggarwal Mar 11 '21 at 16:36
  • But same api work when called with Android device – Dipali Mar 11 '21 at 17:26
  • That seems to be a permission issue. Please make sure you have sufficient permissions in iOS for your process. – Rohit Aggarwal Mar 12 '21 at 03:01
  • I use webview , after login this api called is there any issue? – Dipali Mar 12 '21 at 04:51
  • That depends on your use case on what you are trying to do. Can you please elaborate what are you trying to do ? – Rohit Aggarwal Mar 12 '21 at 04:57
  • backend not access any api without login but i use after login this api. and in my progressive web app i use notification so every 30 seconds called this api. and it works in android device but when i use in ios simulator it gives access denied – Dipali Mar 12 '21 at 05:09
  • Can you please it this helps [https://stackoverflow.com/questions/44157046/how-to-ask-user-permission-for-receiving-notifications] in having the permission for notification access? – Rohit Aggarwal Mar 12 '21 at 06:12
  • 1
    yes i will check but this is the problem of api calling not the notification issue, if i put the notification code outside the api then its work fine. – Dipali Mar 12 '21 at 07:11

0 Answers0