Ich habe eine App mit ionic erstellt und sie ist fast fertig (es ist eine Cart-Shop-App). Jetzt, da ich die App erstellen möchte, verwende ich den folgenden Befehl:

ionic cordova build --release --prod --verbose XXXXX

Dabei ist XXXXX entweder ios oder android.

Beim Erstellen der App für Android (nach dem Signieren usw. usw.) dauert die App auf dem Begrüßungsbildschirm etwa 3 oder 4 Sekunden. Dies ist eine akzeptable Zeit. Das Problem tritt jedoch auf, wenn ich denselben Befehl zum Erstellen für ios verwende. Ich habe versucht, die App in XCode zu testen und es funktioniert. Das einzige Problem ist, dass die App 30 SEKUNDEN dauert, was die App unbrauchbar macht und ich kann herausfinden, warum.

Bearbeiten: auch ich dachte, dass das Problem der Emulator war, aber ich habe auch versucht, die App auf einem Gerät auszuführen, das gleiche Ergebnis.

Unten werde ich die Informationen hinterlassen:

Ioneninfo

Ionic:

   Ionic CLI                     : 6.11.7 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 4.11.10
   @angular-devkit/build-angular : 0.803.29
   @angular-devkit/schematics    : 8.3.29
   @angular/cli                  : 8.3.29
   @ionic/angular-toolkit        : 2.3.2

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 14 other plugins)

Utility:

   cordova-res : 0.15.1
   native-run  : 1.0.0

System:

   ios-deploy : 1.11.1
   ios-sim    : 8.0.2
   NodeJS     : v12.16.1 (/usr/local/bin/node)
   npm        : 6.14.8
   OS         : macOS Catalina
   Xcode      : Xcode 11.7 Build version 11E801a

Paket JSON

{
  "name": "store-app",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint --typeCheck",
    "e2e": "ng e2e",
    "clean-project": "rm -rf www && rm -rf platforms && rm -rf node_modules && rm -rf plugins"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "~1.0.0",
    "@angular/common": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/forms": "^8.2.14",
    "@angular/platform-browser": "^8.2.14",
    "@angular/platform-browser-dynamic": "^8.2.14",
    "@angular/router": "^8.2.14",
    "@ionic-native/android-permissions": "^5.27.0",
    "@ionic-native/background-mode": "^5.26.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/firebase-analytics": "^5.28.0",
    "@ionic-native/geolocation": "^5.10.0",
    "@ionic-native/header-color": "^5.26.0",
    "@ionic-native/keyboard": "^5.14.0",
    "@ionic-native/location-accuracy": "^5.27.0",
    "@ionic-native/onesignal": "^5.13.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic-native/unique-device-id": "^5.9.0",
    "@ionic/angular": "^4.1.0",
    "@ionic/lab": "^3.1.7",
    "@ngx-translate/core": "^10.0.0",
    "@ngx-translate/http-loader": "^3.0.0",
    "animate.css": "^4.1.0",
    "com.testfairy.cordova-plugin": "^2.25.0",
    "cordova-browser": "6.0.0",
    "cordova-plugin-background-mode": "^0.7.3",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-geolocation": "^4.0.2",
    "cordova-plugin-headercolor": "^1.0.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.1.3",
    "cordova-plugin-splashscreen": "^6.0.0",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-uniquedeviceid": "^1.3.2",
    "cordova-plugin-whitelist": "^1.3.4",
    "core-js": "^2.5.4",
    "onesignal-cordova-plugin": "^2.5.2",
    "rxjs": "~6.6.2",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.800.0",
    "@angular-devkit/build-angular": "~0.803.29",
    "@angular-devkit/core": "~8.3.29",
    "@angular-devkit/schematics": "~8.3.29",
    "@angular/cli": "~8.3.29",
    "@angular/compiler": "~8.2.14",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@ionic/angular-toolkit": "~2.3.2",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.14.2",
    "codelyzer": "~5.2.1",
    "cordova-android": "9.0.0",
    "cordova-ios": "^6.1.0",
    "cordova-plugin-advanced-geolocation": "git+https://github.com/esri/cordova-plugin-advanced-geolocation.git",
    "cordova-plugin-android-permissions": "^1.0.2",
    "cordova-plugin-androidx-adapter": "^1.1.1",
    "cordova-plugin-firebase-analytics": "^4.3.1",
    "cordova-plugin-request-location-accuracy": "^2.3.0",
    "cordova-support-android-plugin": "^1.0.2",
    "cordova-support-google-services": "^1.4.1",
    "husky": "~4.2.5",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lint-staged": "^10.2.2",
    "node-sass": "^4.13.1",
    "prettier": "^2.0.5",
    "protractor": "~5.4.0",
    "ts-node": "~8.10.2",
    "tslint": "~5.18.0",
    "tslint-config-prettier": "~1.18.0",
    "tslint-etc": "^1.10.1",
    "typescript": "~3.5.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-uniquedeviceid": {},
      "cordova-plugin-geolocation": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-background-mode": {},
      "com.testfairy.cordova-plugin": {},
      "cordova-plugin-advanced-geolocation": {},
      "cordova-plugin-headercolor": {},
      "cordova-plugin-android-permissions": {},
      "cordova-plugin-request-location-accuracy": {
        "PLAY_SERVICES_LOCATION_VERSION": "16.+"
      },
      "cordova-plugin-firebase-analytics": {
        "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true"
      },
      "cordova-plugin-androidx-adapter": {}
    },
    "platforms": [
      "android",
      "browser",
      "ios"
    ]
  }
}

Config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="1" id="com.btd.buggy" version="0.0.1" 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>Buggy</name>
    <description>Store App</description>
    <author email="test@test.com" href="https://test-app.com/">Buggy</author>
    <content src="index.html" />
    <access origin="*" />
    <access origin="about:*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-navigation href="*" />
    <allow-navigation href="about:*" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="22" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="30000" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="AutoHideSplashScreen" value="false" />
    <preference name="Orientation" value="portrait" />
    <preference name="AndroidXEnabled" value="true" />
    <preference name="GradlePluginGoogleServicesEnabled" value="true" />
    <preference name="GradlePluginGoogleServicesVersion" value="4.2.0" />
    <engine name="android" spec="9.0.0" />
    <platform name="android">
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            <application android:usesCleartextTraffic="true" />
        </edit-config>
        <resource-file src="google-services.json" target="app/google-services.json" />
        <allow-intent href="market:*" />
        <preference name="android-targetSdkVersion" value="28" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
        <resource-file src="resources/android/notification/drawable-mdpi/ic_stat_onesignal_default.png" target="app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png" />
        <resource-file src="resources/android/notification/drawable-hdpi/ic_stat_onesignal_default.png" target="app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png" />
        <resource-file src="resources/android/notification/drawable-xhdpi/ic_stat_onesignal_default.png" target="app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png" />
        <resource-file src="resources/android/notification/drawable-xxhdpi/ic_stat_onesignal_default.png" target="app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png" />
        <resource-file src="resources/android/notification/drawable-xxxhdpi/ic_stat_onesignal_default.png" target="app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png" />
    </platform>
    <platform name="ios">
        <resource-file src="GoogleService-Info.plist" target="app/GoogleService-Info.plist" />
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
        <icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
        <icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
        <icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
        <icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
        <icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" />
        <icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" />
        <icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" />
        <icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" />
        <icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" />
        <icon height="216" src="resources/ios/icon/icon-108@2x.png" width="216" />
        <splash height="2688" src="resources/ios/splash/Default-2688h~iphone.png" width="1242" />
        <splash height="1792" src="resources/ios/splash/Default-1792h~iphone.png" width="828" />
        <splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
    </platform>
    <platform name="ios">
        <config-file parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist">
            <string>Buggy necesita acceder a tu ubicación para poder brindarte un mejor servicio.</string>
        </config-file>
        <config-file parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist">
            <string>Buggy necesita acceder a tu ubicación para poder brindarte un mejor servicio.</string>
        </config-file>
    </platform>
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <plugin name="cordova-plugin-statusbar" spec="2.4.2" />
    <plugin name="cordova-plugin-device" spec="2.0.2" />
    <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
    <plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
    <plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
    <plugin name="cordova-plugin-advanced-geolocation" spec="https://github.com/esri/cordova-plugin-advanced-geolocation.git" />
    <plugin name="cordova-plugin-uniquedeviceid" spec="1.3.2" />
    <plugin name="onesignal-cordova-plugin" spec="2.5.2" />
</widget>

App-Routing-Modul


@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      preloadingStrategy: PreloadAllModules,
    }),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}

Wo Routen alle meine Routen sind, habe ich 38 Ansichten.

Auch in meinem App-Modul habe ich alle meine Dienste geladen, aber ich denke nicht, dass das wichtig ist, da der Winkel auch langsam sein sollte.

Danke, dass du das gelesen hast.

0
Prince Hernandez 2 Sept. 2020 im 16:08

2 Antworten

Beste Antwort

Grundsätzlich habe ich das Problem gefunden, die bisherigen Entwickler der App haben auf dem config.xml folgende Zeilen hinterlassen:

<preference name="SplashScreenDelay" value="30000" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="false" />

Daher funktionierte die Funktion zum Ausblenden des Begrüßungsbildschirms auf iOS nicht. Entfernen Sie daher diese Zeilen und fügen Sie Folgendes hinzu:

<preference name="AutoHideSplashScreen" value="false" />

Damit es funktioniert, ist das einzige, was für mich seltsam ist, dass dieses Verhalten auf Android nicht vorhanden ist, aber jetzt funktioniert alles wie erwartet.

0
Prince Hernandez 11 Sept. 2020 im 13:49

Ich habe mehrere Apps auf beiden Plattformen und kann bestätigen, dass es keinen solchen Unterschied zwischen Plattformen gibt. Die Leistung sollte ähnlich sein.

Ich denke, Sie müssen Ihren Code überprüfen und sehen, was passiert, bevor Sie den Begrüßungsbildschirm ausblenden. Grenzen Sie es dann ein, indem Sie Funktionen entfernen / hinzufügen, um festzustellen, wo das Problem liegt.

Wenn Sie ein iOS-spezifisches Plugin verwenden, kann dies ein Grund sein. Außerdem erfordern einige Plugins je nach Plattform möglicherweise unterschiedliche Konfigurationen.

Ohne das Debuggen Ihres Codes ist es schwierig zu sagen, wo das Problem liegen könnte. Ich würde empfehlen, ein leeres Projekt zu erstellen und weiterhin Ihre Funktionen hinzuzufügen, um festzustellen, wo der Engpass liegt. Wenn wir das spezifische Problem identifizieren können, können wir helfen, es zu beheben, aber ohne den Engpass zu kennen, ist es schwierig, etwas zu sagen ...

Unabhängig davon ist der Simulator immer langsamer als ein tatsächliches Gerät, wie Sie vermutet haben

0
Doug 3 Sept. 2020 im 07:16