Struggling to get comgooglemaps:// working


I’m trying to be able to open Google Maps but I keep getting the error:

(UIKitCore)[12277] <Notice>: -canOpenURL: failed for URL: "comgooglemaps://" - error: "This app is not allowed to query for scheme comgooglemaps"

It’s very odd though, because when I actually open the URL it works just fine, but the -canOpenURL doesn’t seem to want to detect that Google Maps can be opened. I’ve added the following to my config.xml

<edit-config target="LSApplicationQueriesSchemes" file="*-Info.plist" mode="merge">

I can’t think of what else would cause that function canOpenURL to fail with comgooglemaps but yet all the other URL’s work just fine (such as waze).

Anyone else face similar issues?


Can you verify the Info.plist included in your IPA is as you expect?

Good point! I don’t have an Apple computer, but I do notice that actually when I change .ipa to a zip and search the jumbled up Info.plist file, I can find comgooglemaps-x-callback and comgooglemapsurl but not the original comgooglemaps on its own… (there should be three, but only find two comgooglemaps in the whole document) it seems to not be included, as well as a couple of others.

You’re on the right track. On any operating system you can extract the .ipa using a zip extraction tool and you should find the Info.plist in there. It may be in binary format, but it still should be readable for the most part. You are welcome to share the .ipa or .plist with if you need a hand.

Thanks so much! I’ve dropped an email now to be sure.

Thanks for your help - just to keep everyone updated on the Forum, we thought the issue maybe due to a plugin causing issues, so I tried a few things:

First I noticed a plugin called cordova-plugin-queries-schemes which might have been causing the conflict – this didn’t appear to fix the issue removing it.

I then read the issue could be due to the edit-configs being within platform parent tags, but this also didn’t appear to have any effect when I removed those and put the platform attribute in the edit-config itself. ( Keys added using edit-config no longer included in Info.plist for iOS · Issue #615 · phonegap/build · GitHub )

Finally, I removed every single plugin available in my config.xml file, and this also for some reason kept removing large chunks of the items in the array, but keeping others (such as gzpit which is our other app, this is always retained).

As I’ve now tried compiling with all plugins removed, I’m rather scratching my head with this one. Is there something in the compiling process I’m missing that could also cause it?

Thanks again!

Are you able to share the zip file you’re uploading with our support? We’d like to take a look at it ourselves. I suspect there’s still some plugin or other bit of code adding those items.

Okay! Seems I did miss one plugin during my test, the plugin I was trying to get to work in the first place and that is the plugin that for some reason is removing the schemes.

Looking at the plugin.xml - it seems to have

<config-file target="*-Info.plist" parent="LSApplicationQueriesSchemes">

I thought that perhaps it is toggling the options, so tried removing all those, but noticed none were appended and my original two stayed. So, I then tried keeping my two and adding all those items in the config.xml - and sadly, it stripped all those listed except for my two. (and ofcourse disabling the plugin, all remained). The only thing I can think of is that the code above does not have a “mode” attribute, and I can not figure out what the default behaviour is in those circumstances.

Thanks again for your help.

Just with a bit of a hacky solution, which seems to have worked, I’ve used the plugin cordova-custom-config to enforce the configuration change.

If a plugin is changing the configuration, and config.xml doesn’t get priority, we’ll let a plugin make the change instead, and appears to have worked!

I’ll mark this as the answer-ish… its not pretty, but it works.

Thanks again!

Great to hear!