Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS app crashes when I click Google Sign-In button

I'm using the Google Sign-In library for iOS, and when I click the Sign-In button the app crashes with the following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
 'Your app must support the following URL schemes: <my bundleID>,
 com.googleusercontent.apps.<my client ID>'

I inspected the signed version of my app to make sure that those URL schemes are defined, which they are.
I also added 'google' as the identifier for each of the URL schemes because I saw that that's what is done in the sample Google Sign-In app.

This only happens when I build the signed version of my app and do an ad-hoc installation on my phone.
It doesn't happen when running in the simulator through Xcode, or even when running the app for release on the simulator through Xcode.

Does anyone know what to do about this?

Other info that might be useful:
I'm using the Google Sign-In library without cocoapods.
I dragged the library bundle and framework into my project.

Also, I'm using a generic provisioning profile which contains a wildcard in the App ID, and for some reason when I build the signed version of the app the bundle ID of my app gets changed to have the wildcard in it.
i.e. the bundle id gets changed from com.example.app to com.example.*.
Because of this, I added in a third URL scheme which contains the wildcard.

like image 319
user3798820 Avatar asked Jul 29 '15 19:07

user3798820


1 Answers

Add the URL scheme:

  1. Under Project -> Info -> URL Types
  2. Create new URL types
  3. Under URL scheme add your bundle identifier.

This resolves the issue.

like image 101
sahiljain Avatar answered Sep 21 '22 10:09

sahiljain