Cordova iOS 5.1.1上的Axios网络错误-突然停止工作 JS config.xml

问题描述

我正在使用@nuxtjs/axios 5.12.1 axios 0.19.2 vue-axios 2.1。 5 以在iOS上使用Cordova执行GET请求。我已经将cordova-ios软件包安装在版本 5.1.1 上,并配置为发出请求,但是每次我尝试向域发出API请求时,例如:https://example.com/page,我收到Axios错误

网络错误

它不是很有用,我在Android或Web浏览器中没有收到此错误。直到最近,它一直工作得很好,我还缺少什么...

JS

const url = 'https://example.com/api'
this.axios.get(url,{ timeout: 60000 }).then(response => {
  alert(response)
}).catch(err => {
  alert(err) // just shows 'Network Error'
})

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="101050" id="com.company.myApp" ios-CFBundLeversion="1.1.5" version="1.1.5" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>myApp</name>
    <description>
        test
    </description>
    <author email="contact@example.co.uk" href="http://www.example.co.uk">
        domain
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <preference name="disallowOverscroll" value="true" />
    <platform name="android">
        <icon density="xxxhdpi" src="res/icon/android/icon-192-xxxhdpi.png" />
        <icon density="xxhdpi" src="res/icon/android/icon-144-xxhdpi.png" />
        <icon density="xhdpi" src="res/icon/android/icon-96-xhdpi.png" />
        <icon density="hdpi" src="res/icon/android/icon-72-hdpi.png" />
        <icon density="mdpi" src="res/icon/android/icon-48-mdpi.png" />
        <icon density="ldpi" src="res/icon/android/icon-36-ldpi.png" />
        <splash src="res/splash/android/Default@2x~universal~anyany.png" />
        <allow-intent href="market:*" />
        <custom-config-file parent="/*" target="AndroidManifest.xml">
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
            <uses-permission android:name="android.permission.REQUEST_IGnorE_BATTERY_OPTIMIZATIONS" />
            <uses-permission android:name="android.permission.WAKE_LOCK" />
        </custom-config-file>
        <preference name="android-windowSoftInputMode" value="adjustPan" />
        <preference name="android-minSdkVersion" value="28" />
        <preference name="android-targetSdkVersion" value="29" />
    </platform>
    <platform name="ios">
        <preference name="WKWebViewOnly" value="true" />
        <feature name="CDVWKWebViewEngine">
            <param name="ios-package" value="CDVWKWebViewEngine" />
        </feature>
        <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
        <icon height="1024" src="res/icon/ios/icon-1024.png" width="1024" />
        <icon height="180" src="res/icon/ios/icon-180.png" width="180" />
        <icon height="167" src="res/icon/ios/icon-167.png" width="167" />
        <icon height="152" src="res/icon/ios/icon-152.png" width="152" />
        <icon height="120" src="res/icon/ios/icon-120.png" width="120" />
        <icon height="87" src="res/icon/ios/icon-87.png" width="87" />
        <icon height="76" src="res/icon/ios/icon-76.png" width="76" />
        <icon height="60" src="res/icon/ios/icon-60.png" width="60" />
        <icon height="40" src="res/icon/ios/icon-40.png" width="40" />
        <splash src="res/splash/ios/Default@2x~universal~anyany.png" />
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <plugin name="cordova-plugin-console" spec="^1.1.0" />
    <plugin name="cordova-plugin-actionsheet" spec="^2.3.3" />
    <plugin name="cordova-plugin-local-notification" spec="https://github.com/katzer/cordova-plugin-local-notifications.git">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="26.+" />
    </plugin>
    <plugin name="cordova-plugin-file" spec="^6.0.2" />
    <plugin name="cordova-plugin-device" spec="^2.0.3" />
    <plugin name="cordova-plugin-app-event" spec="^1.2.2" />
    <plugin name="cordova-plugin-inappbrowser" spec="^3.1.0" />
    <plugin name="cordova-plugin-native-keyboard" spec="^2.0.5">
        <variable name="LICENSE" value="TRIAL" />
        <variable name="LIC_ANDROID" value="TRIAL" />
        <variable name="LIC_IOS" value="TRIAL" />
    </plugin>
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <engine name="android" spec="^9.0.0" />
</widget>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...