iosionic-frameworkionic3ionic-nativeionic-appflow

Ionic (Appflow): Please register custom URL scheme - scheme present in plist file


I have an interesting problem I've never come across before. On a new iOs project when trying to use the FirebasePlugin.getVerificationID throws the following error:

'Please register custom URL scheme 'com.googleusercontent.apps.xxxxx' in the app's Info.plist file.'

The example function is:

if (!data.phoneNumber) {
  return;
}

let phoneNumberString = "+44" + data.phoneNumber;

(<any>window).FirebasePlugin.getVerificationID(phoneNumberString, id => {
  this.navCtrl.push('verify', { id: id });
}, error => {
  console.error("SMS error", error);
})

I compile the app with Ionic Appflow and therefore do not use XCode to manager the project files. To address the above error I placed the following code in 'GoogleService-Info.plist':

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>REVERSED_CLIENT_ID</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.xxx</string>
            </array>
        </dict>
    </array>

However, this still returns the error even though the plistfile is included in the compiling of the app.

I welcome any thoughts anyone may have.


Solution

  • I solved this issue. The issue related to the way in which I was calling the plist. Due to how AppleFlow operates, it doesn't include certain values from GoogleServices plist. To address this, I included the following in config.xml which solved it.

        <config-file parent="CFBundleURLTypes" target="*-Info.plist">
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLName</key>
                <string>REVERSED_CLIENT_ID</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>com.googleusercontent.apps.XXXXXXXXXXXX</string>
                </array>
            </dict>
        </config-file>