ios - Xcode ios react 应用程序仅阻止进入模拟器
问题描述
我有一个在反应中创建的 ios 应用程序,当我在控制台 ionic serve 中运行时一切正常,当我将应用程序运行到模拟器中时,应用程序在 Axios 请求上被阻止。
const sendGetRequest = () => {
return axios({
url: "https://example.com/wp-json/survey/v1/listOfQuestions",
method: 'get'
}).then(response => {
var answerQuestionsFirstTimeCounting = [];
for (let index = 1; index <= response.data.length; index++) {
if(response.data[index] != undefined) {
var categoryName =response.data[index].category.toLowerCase();
//categoryName = categoryName.replaceAll(" ", "_");
var search = ' ';
var replaceWith = '_';
categoryName = categoryName.split(search).join(replaceWith);
if(!questionsCategories.includes(categoryName)) {
questionsCategories.push(categoryName);
}
}
answerQuestionsFirstTimeCounting[index] = 0;
}
nrQuestions = response.data.length;
return response.data;
})
};
我无法看到有关此错误的一些日志详细信息。相同的代码正在应用程序 android 上运行。
更有Xcode经验的人可以帮我告诉我,我可以在哪里调试,看看问题出在哪里?
更新:
我已经使用 proxyman 工具来跟踪请求,但我有这个错误:
交叉源没问题,我在服务器上设置了分配来自everywere 的请求
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
ssl 证书正常是绿色的 另一台服务器上的相同 API 正在工作,但此服务器没有。我不知道问题出在哪里,为什么请求仅在 ios 模拟器和真实设备中被拒绝。
任何想法或建议将不胜感激
解决方案
推荐阅读
- elasticsearch - 水平缩放的意思
- jquery - 有什么方法可以将值发送到 MVC 中的受保护覆盖 void OnActionExecuted
- asp.net-mvc - 使用 cookie 跨平台通信 Web 应用程序
- vba - 如何在表单中使用级联删除/更新选定元素?
- python - Dockerfile 返回非零代码:1
- java - 为什么从 Java 应用程序运行 MAKE 会导致错误消息?
- python - 使用 Jupyter Notebook 中的输入运行 python 脚本
- php - 什么是 gmp_nextprime 算法?
- r - 使用 tidygraph 将来自相同两个节点的两条边合并为一条
- python - 如何在 Azure 上每 24 小时自动运行一次我的 python 脚本?