Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update iOS pod to >= 5.0.0 and apply migrations for native plugin code. #126

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lukezbihlyj
Copy link
Contributor

Fixes for the updated GoogleSignIn iOS pod version 5.0.0+, see issue #122

@Mukarillo
Copy link

Mukarillo commented Feb 12, 2020

Hey @lukezbihlyj ,

Does your PR fixes this issue?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'

Thank you very much.

@lukezbihlyj
Copy link
Contributor Author

Hey @lukezbihlyj ,

Does your PR fixes this issue?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'

Thank you very much.

That issue usually happens occurs when the app can't find your GoogleService-Info.plist file. I have an editor script that imports the file into the XCode project after the build has completed using this line:

project.AddFileToBuild(targetGuid, project.AddFile(googleServiceInfoPlistPath, "GoogleService-Info.plist"));

Take a look at the Unity docs for how to use the PBXProject class and there are probably some more comprehensive examples on the Unity forums as well.

@Mukarillo
Copy link

Thanks for the heads up, but I don't think thats my problem.
I mean, I can see the GoogleService-Info.plist in xCode hierarchy. Do you have any other tip?
Thanks again man!

@lukezbihlyj
Copy link
Contributor Author

Thanks for the heads up, but I don't think thats my problem.
I mean, I can see the GoogleService-Info.plist in xCode hierarchy. Do you have any other tip?
Thanks again man!

I haven't personally seen that problem unfortunately. You could try adding some logs in here to make sure that the ID is getting extracted properly from your plist file:

NSString *path = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info"
ofType:@"plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
NSString *clientId = [dict objectForKey:@"CLIENT_ID"];
gsiHandler = [GoogleSignInHandler alloc];
// Setup the Sign-In instance.
GIDSignIn *signIn = [GIDSignIn sharedInstance];
signIn.clientID = clientId;
signIn.uiDelegate = gsiHandler;
signIn.delegate = gsiHandler;

@Mukarillo
Copy link

Thank you man.
I am totally noob when it comes to native code, but I will figure it out.
Thanks again!

@Mukarillo
Copy link

Well... that was quick, I created some logs just like you said and you were right, it was not being attached to the build.
After clicking the file in xCode I saw that the Target Membership of my app was not selected.

Thank you very much for helping me out man :)

@ragavendranbala
Copy link

ragavendranbala commented Apr 6, 2020

@lukezbihlyj How to download your pull request as an unitypackage? or zip?

@lukezbihlyj
Copy link
Contributor Author

@ragavendranbala You can download my branch as a .zip from here: https://github.com/lukezbihlyj/google-signin-unity/archive/master.zip

@markyama
Copy link

markyama commented May 2, 2020

Thank you so much for this! My app was getting rejected by Apple because of the ITMS-90809: UIWebView API Deprecation. v1.0.4 of this project uses GoogleSignIn v4.x.x which uses UIWebView. You need to run v5.0.0 or higher of GoogleSignIn. This pull request does that.

Admins, PLEASE merge this pull request. I'm a bit hesitant to include GoogleSignIn in my Unity project as this repo does not seem to be supported anymore. Hopefully people like lukezbihlyj and others will keep things working.

Thanks again

@anisabboud
Copy link

Thanks for your insights and initiative @lukezbihlyj!

Are you guys using Unity 2019.3? The Xcode project structure has changed as of Unity 2019.3 according to https://docs.unity3d.com/Manual/StructureOfXcodeProject.html.

When checking the contents of the .ipa file:
GoogleService-Info.plist moved in Unity 2019.3

  • Unity 2019.2: GoogleSignIn.bundle and GoogleService-Info.plist were under the root folder.
  • Unity 2019.3: GoogleSignIn.bundle and GoogleService-Info.plist are now moved to a subfolder inside Frameworks

Perhaps this is causing the 'You must specify |clientID| for |GIDSignIn|' error & crash on iOS #63...

@pseudocolor
Copy link

@ragavendranbala You can download my branch as a .zip from here: https://github.com/lukezbihlyj/google-signin-unity/archive/master.zip

@lukezbihlyj Im sorry, Im really noob about xcode.
I download your branch as a zip, but what should I do in Unity?
is it only to copy the Assets folder from zip to Unity Assets and build xcode and thats it?

or is there anything else I should do in Xcode,
or where do I download that GoogleSignIn pod 5,0?

thanks so much..

@nicolasgramlich
Copy link

@pseudocolor

You don't need to download the project as a zip. You can just look at the diff in this PR and apply all the changes by hand. Also check your Podfile.lock that it has something like this
image
... indicating that your version is any version greater than 5.0.0. If that's not the case, open the Podfile and make sure it has pod 'GoogleSignIn', '>= 5.0.0' in it (change it if you need to). Then (after backing it up first, to be safe) delete your Podfile.lock and have Unity/Xcode (not sure which one actually) recreate it by kicking off another build. The Podfile.lock should now have a version like in the screenshot. I just did all this with success.

Big thanks to @lukezbihlyj !!

@nicolasgramlich
Copy link

@lukezbihlyj since this project has been abandoned, maybe it's time to make a unofficial fork and provide a fixed unitypackage from there. I'll chip in $10 for the effort :)

@ragavendranbala
Copy link

@nicolasgramlich have you created the unity package?

@nicolasgramlich
Copy link

@ragavendranbala sorry, I've never done that before and don't have the time for it while working on my game (shameless plug: https://play.google.com/store/apps/details?id=com.legioncommander ). If you have any problems let me know and I'll try to help out.

@pseudocolor
Copy link

If you have any problems let me know and I'll try to help out.

@nicolasgramlich will try that this night, thanks

@pseudocolor
Copy link

hey it worked!

thanks @lukezbihlyj , @nicolasgramlich

I just use what on the Assets folder of the zip in unity, but make sure your other sdk or unity package is safe.
Unity ads is built in by default, and it should be upgraded first or just remove them since the default unity ads 2.0 on my Unity still use the uiwebview

@napbla
Copy link

napbla commented Oct 1, 2020

I have created the unity package here because I have to import to many projects. Tell me if there is some bug and thanks @lukezbihlyj for his work. Link to the upgrade unity package: https://drive.google.com/file/d/1N50K62jLxORVTI5xSNEc06o0xyFh9mvu/view?usp=sharing

@hafsaahmed96
Copy link

This update works well! Thanks for your efforts.
However I'm coming across one problem. Those who have any idea to resolve this issue, please let me know.
On every login, it is asking for permission. Sign-in silently function in android works well but in IOS, it gives the prompt for permission and upon approval, it leads to the google account and you have to choose your account everytime.

For reference, please look at this issue. Can it be because of changes made with this update? Please let me know the workaround.
Issue 163

@rumaniel
Copy link

I think this PR must be merged into the main branch and release a new version. Without these changes, it's hard to build or submit to the AppStore.

@DarkStarSword
Copy link

Agreed - it is ridiculous that a company as large as Google can't find anyone in their staff to actively maintain their own sign in plugin. More likely is that no one in their management is even aware of the issue.
https://github.com/addyosmani https://github.com/jkammerl https://github.com/nic0lette https://github.com/PaulRashidi https://github.com/samtstern https://github.com/shrugs https://github.com/thagikura https://github.com/yaraki
^ talk to your managers and make sure they get someone assigned to this.

@viveksavsaiya
Copy link

viveksavsaiya commented Jul 19, 2021

@lukezbihlyj Google release 6.0.0 version recently, It seems couple of class removed/renamed.

@mustafacagataytulun
Copy link

Since Google published GoogleSignIn 6.0.0, GoogleSignInDependencies.xml file should be like

<iosPods>
  <iosPod name="GoogleSignIn" version="~> 5.0.0" bitcodeEnabled="false"
      minTargetSdk="6.0">
  </iosPod>
</iosPods>

Notice the usage of ~>which means "take whatever starting from 5.0.0 until 6.0.0 (excluding 6.0.0)".

@lukezbihlyj
Copy link
Contributor Author

Since Google published GoogleSignIn 6.0.0, GoogleSignInDependencies.xml file should be like

<iosPods>
  <iosPod name="GoogleSignIn" version="~> 5.0.0" bitcodeEnabled="false"
      minTargetSdk="6.0">
  </iosPod>
</iosPods>

Notice the usage of ~>which means "take whatever starting from 5.0.0 until 6.0.0 (excluding 6.0.0)".

Implemented this into my fork, sorry it took so long

@djooryabi
Copy link

This should really be merged in to the official repo! It works perfectly for me.

@UltraKenchie
Copy link

When will google merge this 🙄

@CodeMasterYi
Copy link

see #205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.