Ionic-cli: When I add IOS platform on ionic project getting error "UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'indexOf' of null"

Created on 27 Apr 2018  路  2Comments  路  Source: ionic-team/ionic-cli

ionic cordova platform add ios --save

cordova platform add ios --save
Using cordova-fetch for cordova-ios@^4.5.4

Adding ios project...

Creating Cordova project for the iOS platform:

    Path: platforms\ios
    Package: io.yin.tablesits
    Name: tablesits

iOS project created with [email protected]

(node:13560) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'indexOf' of null
at parseWhitelistUrlForATS (D:\test\ts\platforms\ios\cordova\lib\prepare.js:1038:27)
at D:\test\ts\platforms\ios\cordova\lib\prepare.js:965:23
at Array.reduce ()
at processAccessAndAllowNavigationEntries (D:\test\ts\platforms\ios\cordova\lib\prepare.js:956:10)
at writeATSEntries (D:\test\ts\platforms\ios\cordova\lib\prepare.js:1081:16)
at updateProject (D:\test\ts\platforms\ios\cordova\lib\prepare.js:217:15)
at D:\test\ts\platforms\ios\cordova\lib\prepare.js:59:20
at _fulfilled (D:\test\ts\platforms\ios\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (D:\test\ts\platforms\ios\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (D:\test\ts\platforms\ios\cordova\node_modules\q\q.js:816:13)
(node:13560) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13560) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


$ ionic info

cli packages: (C:\Users\DELL\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 7.0.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v9.8.0
npm               : 5.8.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : C:\Users\DELL\AppData\Local\Android\Sdk

Misc:

backend : pro
triage

Most helpful comment

In your config.xml, after running the ionic cordova run ios command, you will see there is an entry in there along the lines of <allow-navigation href="http://:8100" />. It is trying to parse out the IP address from this line but that is obviously returning null.

To solve, I removed this line and re-ran it. Weirdly it took a couple of runs before it stopped auto-generating this in my config.xml

All 2 comments

I am also experiencing this error as of recently. Any help would be appreciated

In your config.xml, after running the ionic cordova run ios command, you will see there is an entry in there along the lines of <allow-navigation href="http://:8100" />. It is trying to parse out the IP address from this line but that is obviously returning null.

To solve, I removed this line and re-ran it. Weirdly it took a couple of runs before it stopped auto-generating this in my config.xml

Was this page helpful?
0 / 5 - 0 ratings