Ios, building but not running on simulator

#1

Hi, I’m trying to run my app on an iOS simulator from xcode and cli.

It builds & stays stuck on the splash screen.
On android, it builds & run well on any device… I just don’t have an iOS device yet.

Google around the error below, it may point toward a file:// issue, but I don’t have any in my code.
Looking at the link in the log below, it may be induced by the simulation…

App[24680:953536] Ionic Native: deviceready event fired after 995 ms
2019-02-20 22:56:09.401978+0100 App[24680:953536] uuid is: 8fa64ebd-79c4-4c07-aa58-18c66399b1ea
2019-02-20 22:56:09.403680+0100 App[24680:953536] ignore version: NOTHING_TO_IGNORE
**2019-02-20 22:56:09.407911+0100 App[24680:953617] **Redirecting to: file:/Users/bryan/Library/Developer/CoreSimulator/Devices/A8492C0D-D17E-44C6-8373-C5174831111C/data/Containers/Data/Application/7581E730-8A68-4A60-B7DE-227CD2EA7433/Library/Application%20Support/8fa64ebd-79c4-4c07-aa58-18c66399b1ea/index.html?cordova_js_bootstrap_resource=/Users/bryan/Library/Developer/CoreSimulator/Devices/A8492C0D-D17E-44C6-8373-C5174831111C/data/Containers/Bundle/Application/8571EBDB-B309-4E5C-AA76-365635F676DF/App.app/www/cordova.js
2019-02-20 22:56:09.411714+0100 App[24680:953536] Reloading the web view.
2019-02-20 22:56:09.434346+0100 App[24680:953536] Failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)

Ionic:

   ionic (Ionic CLI)             : 4.10.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.1
   @angular-devkit/build-angular : 0.12.4
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.2.4
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 8 other plugins)

System:

   ios-deploy : 1.9.4
   ios-sim    : 7.0.0
   NodeJS     : v11.8.0 (/usr/local/bin/node)
   npm        : 6.5.0
   OS         : macOS Mojave
   Xcode      : Xcode 9.0 Build version 9A235

cordova plugin ls

You have been opted out of telemetry. To change this, run: cordova telemetry on.

cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
cordova-plugin-app-event 1.2.1 "Application Events"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-splashscreen 4.1.0 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Config.xml

    <content src="index.html" />
    <access origin="*" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <allow-intent href="mailto:*" />
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />

Thanks a lot for your help
Best regards

#2

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Safari dev tools: https://ionic.zone/debug/remote-debug-your-app#ios Look at the console and network tabs for errors.

#3

Hi thanks for the reply.

On a real device, I’m not getting the error, but it’s stuck on splash screen too though.

In the console I only see

[Debug] Ionic Stop Scroll injected! (user-script:1, line 50)

In the network I only see index.html which it not loaded, 404.

Summary
URL: ionic://localhost/var/mobile/Containers/Data/Application/AC3A00A8-21CA-42C6-9344-401938A8E4A9/Library/Application%20Support/8fa64ebd-79c4-4c07-aa58-18c66399b1ea/index.html?cordova_js_bootstrap_resource=/var/containers/Bundle/Application/FDBADB93-295B-4D96-8866-5D352A4CA0B1/MyApp.app/www/cordova.js
Status: 404
Source: —

Request
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 Google

Response
Cache-Control: no-cache
Content-Type: text/html

Query String Parameters
cordova_js_bootstrap_resource: /var/containers/Bundle/Application/FDBADB93-295B-4D96-8866-5D352A4CA0B1/MyApp.app/www/cordova.js

Here I lack knowledge to understand why the 404 would occur. Is there anything I should specify for the build to copy data over to the phone?

If I add
<script src="cordova.js"></script>
I’m not getting the 404 but the app is still stuck on the splash screen and I get no console or network traffic from safari, in the localhost context…

Please note, the first time I ran on the device, it downloaded & unzipped to the phone, then got stuck.
I stopped the app from xcode and ran it again. That’s where I am now, but I cannot see a download & extraction of a zip file to the phone…

Thanks for your help
Regards

#4

Create a new Ionic project and see if you can build and run that one.

#5

Hi, after a bit of a struggle, I realised there was a config in XCode that specified to either use Cordova lib or Porject lib to build… it was set to Project and using Cordova it built & ran successfully on the device.
Thanks.