iOS 9 has introduced new changes to canOpenURL requiring the application to whitelist all the schemes it needs to query.
This post on Quick Take on iOS 9 URL Scheme Changes explains why.
At a minimum you need to whitelist you own application’s identifier and your Google OAuth apps id in Info.plist under LSApplicationQueriesSchemes. You can also whitelist the other schemes Google Sign-In queries to silence the other warnings.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>com.example.foo</string>
<string>com.googleusercontent.apps.1234567890-abcdefghijklmnopqrstuvwxyz</string>
<string>com-google-gidconsent-google</string>
<string>com-google-gidconsent-youtube</string>
<string>com-google-gidconsent</string>
<string>com.google.gppconsent.2.4.1</string>
<string>com.google.gppconsent.2.4.0</string>
<string>googlechrome</string>
<string>googlechrome-x-callback</string>
</array>
Just follow the steps in: https://developers.google.com/identity/sign-in/ios/start-integrating#add_url_schemes_to_your_project (including adding the schemes) and it should be working fine.
And, as requested by comments below, I'll emphasise that the problem probably occurred by not adding the URL schemes as described in the link above.
Quoting from the link above:
Google Sign-in requires two custom URL Schemes to be added to your project.
To add the custom schemes:
- Open your project configuration: double-click the project name in the left tree view. Select your app from the TARGETS section, then select the Info tab, and expand the URL Types section.
- Click the + button, and add a URL scheme for your reversed client ID. To find this value, open the GoogleService-Info.plist configuration file, and look for the REVERSED_CLIENT_ID key. Copy the value of that key, and paste it into the URL Schemes box on the configuration page. Leave the other fields blank.
- Click the + button, and add a second URL scheme. This one is the same as your app's bundle ID. For example, if your bundle ID is com.example.app, type that value into the URL Schemes box. You can find your app's bundle ID in the General tab of the project configuration (Identity > Bundle Identifier).
Updated for XCode 7.0 and Google plus Sdk 1.7.1
<key>LSApplicationQueriesSchemes</key>
<array>
<string>com-google-gidconsent-google</string>
<string>com-google-gidconsent-youtube</string>
<string>com-google-gidconsent</string>
<string>com.google.gppconsent.2.4.1</string>
<string>com.google.gppconsent.2.4.0</string>
<string>googlechrome</string>
<string>googlechrome-x-callback</string>
<string>hasgplus4</string>
<string>com.google.gppconsent.2.3.0</string>
<string>com.google.gppconsent.2.2.0</string>
<string>com.google.gppconsent</string>
</array>
Reference Taken from this link
Josh's answer is correct for earlier versions of the Google Sign-in library. However, it looks like starting with version 2.2.0, this step is no longer necessary (hooray!).
So if you're still encountering this issue, my advice might be to update your Google Sign-In library.
After adding the GoogleService-Info.plist to my project, I added the following to the Info.plist file and the errors went away.
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1413410832299369</string>
<string>com.my.app</string> <!-- My app bundle ID -->
<string>com.googleusercontent.apps.1111111111-6jcxxxxxxxikgnso524xxxxxxxx5o9</string> <!-- Reverssed client ID -->
</array>
</dict>
</array>
For me, putting the LSApplicationQueriesSchemes in the info.plist didn't work, but putting it under 'Project > Target > Info > URL Types' did the trick for me.
Add your com.googleusercontent.apps. into URL Types
Click into the Main Project -> Info -> URL Types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With