在ios上工作时,ionic ios构建会出现错误



我开发了ionic版本3的应用程序,我想将其发布到苹果商店,我成功构建了它,但何时提交以审查应用程序被拒绝,因为

在iPad上查看时,我们在您的应用程序中发现了一个或多个错误在Wi-Fi上运行iOS 13.7。您的应用程序启动并显示无响应没有其他内容的白色屏幕。

然后我开始了一个新的离子3项目,我面临着同样的问题。我尝试使用Cordova ios v6和v5进行构建,但我遇到了同样的问题。我使用以下命令构建

ionic cordova platform add ios
ionic cordova run ios --prod -l --external --emulator --consolelogs --target="C62C1D15-1BDF-433C-BD72-2D9957C5F0F7"

当我在iPhone模拟器上运行它时,它运行得很好,但在iPad上给了我这些问题

[app-scripts] [00:02:36]  console.warn: Ionic Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to 
[app-scripts]             a) run in a real device or simulator and b) include cordova.js in your index.html 
[app-scripts] [00:02:36]  console.warn: Ionic Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to a) 
[app-scripts]             run in a real device or simulator and b) include cordova.js in your index.html

使用

cordova v10.0.0

ionic cli v6.11.0

插件使用平台的本地代码。为了执行这些代码,他们依赖Cordova。错误消息";Cordova不可用";在加载cordova之前执行插件代码时抛出。

您应该确保所有与插件相关的代码只有在加载后才能执行。您可以通过订阅平台就绪事件&只有在触发之后才执行插件代码。这方面的一个例子是从"离子角度"导入{平台};

@Component({...})
export MyApp {
constructor(public plt: Platform) {
this.plt.ready().then((readySource) => {
console.log('Platform ready from', readySource);
// Platform now ready, execute any required native code
});
}
}

最新更新