更新角度Cordova-iOS平台后在IPA中获得黑屏

问题描述

最初,我们使用有角度的cordova-ios版本4.5.4,并将IPA上载到Apple Store Connect时出现UIWebView错误,因此将cordova-ios平台升级到5.1.1并添加cordova-plugin-wkwebview-engine插件。现在,在生成IPA时,它将显示空白屏幕,并且不会路由到登录屏幕。

版本详细信息如下:

angular-devkit/architect         0.10.7
@angular-devkit/build-angular     0.10.7
@angular-devkit/build-optimizer   0.10.7
@angular-devkit/build-webpack     0.10.7
@angular-devkit/core              7.0.7
@angular-devkit/schematics        0.8.9
@angular/cli                      6.2.9
@ngtools/webpack                  7.0.7
@schematics/angular               0.8.9
@schematics/update                0.8.9
rxjs                              5.5.12
typescript                        2.9.2
webpack                           4.19.1
cordova-ios                       5.1.1

我们使用以下命令进行构建:

ng build --prod --source-map=false && cordova build ios

我们的config.xml文件

<?xml version='1.0' encoding='utf-8'?>
<widget android-activityName="appname" android-versionCode="10002" id="appname" version="1.0.2" 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>appname</name>
    <description>
         Description
    </description>
    <author email="[email protected]" href="http://appname.com">
        appname
    </author>
    <content src="index.html" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <access origin="*" />
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:usesCleartextTraffic="true" />
    </edit-config>
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="res/icon/android/ldpi.png" />
        <preference name="CustomURLSchemePluginClearsAndroidIntent" value="true" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon density="ldpi" src="res/icon/android/ldpi.png" />
    </platform>
    <hook src="hooks/appBeforeBuild.js" type="before_build" />
    <hook src="hooks/appBeforeBuild.js" type="before_run" />
    <engine name="browser" spec="^5.0.3" />
    <plugin name="cordova-plugin-dbcopy" spec="^2.1.2" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-network-@R_622_4045@ion" spec="^2.0.1" />
    <plugin name="uk.co.workingedge.cordova.plugin.sqliteporter" spec="^1.1.0" />
    <plugin name="cordova-plugin-device" spec="^2.0.2" />
    <plugin name="cordova-plugin-printer" spec="^0.7.3" />
    <plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
    <plugin name="cordova-plugin-customurlscheme" spec="^4.4.0">
        <variable name="URL_SCHEME" value="URL_SCHEME_NAME" />
        <variable name="ANDROID_SCHEME" value=" " />
        <variable name="ANDROID_HOST" value=" " />
        <variable name="ANDROID_PATHPREFIX" value="/" />
    </plugin>
    <plugin name="cordova-plugin-dialogs" spec="^1.3.3" />
    <plugin name="cordova-plugin-bluetoothle" spec="^4.5.10" />
    <plugin name="cordova-plugin-bluetooth-peripheral-usage-description" spec="^1.0.1">
        <variable name="TEXT" value="Some string" />
    </plugin>
    <plugin name="cordova-plugin-geolocation" spec="^4.0.2" />
    <plugin name="cordova-plugin-android-permissions" spec="^1.0.2" />
    <plugin name="cordova-plugin-ble-central" spec="^1.2.5" />
    <plugin name="cordova-plugin-inappbrowser" spec="^3.2.0" />
    <plugin name="cordova-plugin-permission" spec="^0.1.0" />
    <plugin name="cordova-plugin-vibration" spec="^3.1.1" />
</widget>

解决方法

不幸的是,白屏错误非常普遍,因为控制台中未列出错误条件(请参见Cordova - white screen after splash,no exceptions in console)。

但是,您可以在iOS模拟器中启动该应用程序并将其连接到Safari的开发工具,然后单击刷新。它应该排除iOS正在运行的异常。