简体   繁体   English

离子 ios 构建在 ios 上工作时出错

[英]ionic ios build give error whe work on ios

I worked on ionic version 3 app I want to publish it to the apple store I build it successfully but when to submit it to review the app rejected because我在 ionic 版本 3 应用程序上工作 我想将它发布到苹果商店 我成功构建它但何时提交它以审查应用程序被拒绝,因为

We discovered one or more bugs in your app when reviewed on iPad running iOS 13.7 on Wi-Fi.Your app launches and shows an unresponsive white screen with no other content.在通过 Wi-Fi 运行 iOS 13.7 的 iPad 上查看时,我们发现了您的应用程序中的一个或多个错误。您的应用程序启动并显示无响应的白屏,没有其他内容。

then I start a new ionic 3 project and I faced the same problem.然后我开始了一个新的 ionic 3 项目,我遇到了同样的问题。 I tried to build using Cordova ios v6 and v5 but I have the same problem.我尝试使用 Cordova ios v6 和 v5 进行构建,但我遇到了同样的问题。 I build it using these commands我使用这些命令构建它

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

when I run it on iPhone emulator it works well but on iPad give me these issues当我在 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

using使用

cordova v10.0.0科尔多瓦 v10.0.0

ionic cli v6.11.0离子cli v6.11.0

Plugins use the platform's native code.插件使用平台的本机代码。 To execute that code, they rely on Cordova.为了执行该代码,他们依赖 Cordova。 The error message "Cordova is not available" is thrown when the plugin code is executed before cordova has loaded.在加载cordova之前执行插件代码时会抛出错误消息“Cordova不可用”。

You should ensure that all plugin related code is executed only after they have been loaded.您应该确保所有与插件相关的代码仅在加载后才执行。 You can do this by subscribing to the platform ready event & executing plugin code only after that is fired.您可以通过订阅平台就绪事件并仅在触发后执行插件代码来做到这一点。 An example of this would be import { Platform } from 'ionic-angular';一个例子是 import { Platform } from 'ionic-angular';

@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
    });
  }
}

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

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