Cannot read property 'indexOf' of null ( iOS )

I get this error when i run “ionic cordova platform add ios” and “ionic cordova build ios”, however when i run android it doesn’t happen and “ionic serve” works fine.
Please note that I am using a mac and these command were working fine before.
Grateful if someone can help me. Thanks.

Ionic Info:

cli packages: (/usr/local/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) 

local packages:

    @ionic/app-scripts : 3.2.1
    Cordova Platforms  : android 7.1.1 ios 4.5.5
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.4
    npm               : 5.6.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.4.1 Build version 9F2000 

Environment Variables:

    ANDROID_HOME : /Users/Apple/Library/Android/sdk/

Misc:

    backend : pro

Here is the error:
31