简体   繁体   English

出现网络错误时如何在iOS上调试Axios?

[英]How to debug Axios on iOS when getting network error?

I tested my application finally in iOS and found out that AXIOS don't work on Chrome and Firefox. 我终于在iOS中测试了我的应用程序,发现AXIOS在Chrome和Firefox上不起作用。

I don't know much about iOS debug tools but I used chrome://inspect on my iPad and can read: 我对iOS调试工具了解不多,但我在iPad上使用了chrome:// inspect并可以读取:

Error: Network Error 错误:网络错误

I simplified the code and always get this error on iOS while it is working fine on the desktop browsers. 我简化了代码,并在iOS上在桌面浏览器上正常运行时始终收到此错误。

axios.get('/request' )
.then(function(res){
    console.log(res);
}).catch(function(err){
    console.log(err);
});

My iOS browsers don't have a JavaScript console that can show details on the objects. 我的iOS浏览器没有可显示对象详细信息的JavaScript控制台。 I don't know how to debug because there are no issues on desktop browsers. 我不知道如何进行调试,因为台式机浏览器没有问题。 The backend has empty logfile, so it may not send out any GET request. 后端的日志文件为空,因此它可能不会发出任何GET请求。

I found the cause of this problem but don't understand: 我找到了此问题的原因,但不了解:

axios.defaults.baseURL = "https://example.com";  // my correct domain name

Removing this line that included my domain solved the issue. 删除包含我的域的这一行即可解决此问题。

Why did't it work only on iOS (I didn't tested Android) while still working on desktop browsers? 为什么它不能仅在iOS(我未测试Android)上运行,而仍在桌面浏览器上运行?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM