1
我似乎無法得到以下獲取調用在Android上工作。它沒有打到服務器,似乎沒有拋出任何錯誤。相同的代碼適用於iOS。我需要做些特別的事情才能在React Native上啓用Android的網絡請求嗎?提前致謝。React在iOS但不是Android的工作原生提取調用
export const login = function(user, success, error) {
let path='http://localhost:3000/api/session';
fetch(path, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({user: user})
}).then((response) => {
return response.json();
}).then(success).catch(error);
};