简体   繁体   中英

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

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.

then I start a new ionic 3 project and I faced the same problem. I tried to build using Cordova ios v6 and v5 but I have the same problem. 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

[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

ionic cli v6.11.0

Plugins use the platform's native code. To execute that code, they rely on Cordova. The error message "Cordova is not available" is thrown when the plugin code is executed before cordova has loaded.

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';

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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