googlesamples / google-signin-unity

Google Sign-In API plugin for Unity game engine. Works with Android and iOS.
Other
417 stars 227 forks source link

'You must specify |clientID| for |GIDSignIn|' #63

Open samavan opened 6 years ago

samavan commented 6 years ago

Full error from Xcode :

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'

For now I am just build the demo scene provided from an empty project. Nothing fency. Unity Build Settings BundleId matches with the clients ID.

I made many client ID for different platform, tried all of them and always having the same error. I edit the WebClientId from the Signing Sample Script from the demo scene.

screen shot 2018-09-26 at 12 33 13

Any idea what do I do wrong?....

Thank you! :)

samavan commented 6 years ago

Also did this : After generating the XCode project from Unity, download the GoogleService-Info.plist file from the Google Developers website and add it to your XCode project.

But error remains :

screen shot 2018-09-26 at 14 14 27
doggan commented 6 years ago

The clientId gets set here: https://github.com/googlesamples/google-signin-unity/blob/master/GoogleSignInPlugin/Assets/Plugins/iOS/GoogleSignIn/GoogleSignInAppController.mm#L65-L79

Make sure it's actually being loaded from your plist here. You can set a breakpoint or add some debug logging to figure out what's going on.

korober commented 5 years ago

@doggan thank you, in my case the problem was in the plist's file name... When you downloads plist file from Google Console, it's name looks like 'client_xxxxxxxxxx.apps.googleusercontent.com.plist', but file name should be "GoogleService-Info.plist"

shadesbelow commented 5 years ago

ya, the plist needs to be called "GoogleService-Info.plist" and it needs to be added to the root of the xcode project. also you need to create a url scheme with the reverse client id.

dhruvmodhapp commented 5 years ago

I have same issue. I tried to renaming downloaded plist to 'GoogleService-Info.plist'. Still there is issue ou must specify |clientID| for |GIDSignIn|. I also put reverse client id to xcode setting.

highpockets commented 4 years ago

Has anyone solved this yet?? I'm having the issue now and I have GoogleService-Info.plist in my root with the client ID and the reverse client id..

highpockets commented 4 years ago

This was a simple target membership issue in xcode for me. The GoogleService-Info.plist was in the root, but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out

pmse18 commented 4 years ago

@highpockets I am having the same issue, while trying Google Sign In in my iPhone, it is crashing with 'You must specify |clientID| for |GIDSignIn|'. I have included the Google-Service-Info.plist file in the root also. But don't know what does this mean :

""but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out""

Can you help me with it?

CyanDeveloper commented 4 years ago

@highpockets I am having the same issue, while trying Google Sign In in my iPhone, it is crashing with 'You must specify |clientID| for |GIDSignIn|'. I have included the Google-Service-Info.plist file in the root also. But don't know what does this mean :

""but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out""

Can you help me with it?

Hi! After select the Google-Service-Info.plist file from the "Project navigator" window, you will see on the right the "Target Membership" section. Add the check mark to you application and try rebuild te app. It works for me!

highpockets commented 4 years ago

@highpockets I am having the same issue, while trying Google Sign In in my iPhone, it is crashing with 'You must specify |clientID| for |GIDSignIn|'. I have included the Google-Service-Info.plist file in the root also. But don't know what does this mean :

""but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out""

Can you help me with it?

@pmse18 sorry for the late reply!! Did you sort it out?? My explanation was pretty bare, but it’s just like @CyanDeveloper says

ayazthegunner commented 4 years ago

This was a simple target membership issue in xcode for me. The GoogleService-Info.plist was in the root, but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out

does anyone know how can we do this through unity pbxproject? I am using cloud to build my project and facing the same crash issue.

creativeIKEP commented 3 years ago

This was a simple target membership issue in xcode for me. The GoogleService-Info.plist was in the root, but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out

Thanks you for your comments. I haved same problem, but my app work after GoogleService-Info.plist file's Target Membership change 'UnityFramework' to 'Unity-iPhone'!!

@ayazthegunner

This was a simple target membership issue in xcode for me. The GoogleService-Info.plist was in the root, but the Target Membership of it was just set to UnityFramework, when I included my build target 'Unity-iPhone' it all worked out

does anyone know how can we do this through unity pbxproject? I am using cloud to build my project and facing the same crash issue.

It was realized auto Target Membership changing with bellow code. I hope it your helps...

[PostProcessBuild(999)]
    public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
    {
        var projPath = buildPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
        var proj = new PBXProject();
        proj.ReadFromFile(projPath);

        var targetGuid = proj.GetUnityMainTargetGuid();
        var googleServeiceInfoGuid = proj.FindFileGuidByProjectPath("GoogleService-Info.plist");
        //turn off 'UnityFramework' Target Membership
        proj.RemoveFileFromBuild(proj.GetUnityFrameworkTargetGuid(), googleServeiceInfoGuid);
        //turn on 'Unity-iPhone' Target Membership
        proj.AddFileToBuild(targetGuid, googleServeiceInfoGuid);

        proj.WriteToFile(projPath);
    }
derwaldgeist commented 3 years ago

Just learned that you also have to add an URL scheme to the app.

This can be done here: https://docs.unity3d.com/Manual/PlayerSettingsiOS-Other.html#Configuration

The URL scheme is the same as the same as the Reverse Client ID. Guys, this is really f*** complex.

derwaldgeist commented 3 years ago

An easier way to get the .plist into your Xcode project is to copy it to the StreamingAssets folder inside Unity, and then place this script under an Editor folder:

using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;

public static class GoogleSignInPostBuild {

[PostProcessBuild(999)]
public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
{
    var projPath = buildPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
    var proj = new PBXProject();
    proj.ReadFromFile(projPath);
    var targetGuid = proj.GetUnityMainTargetGuid();
    proj.AddFileToBuild(targetGuid, proj.AddFile("Data/Raw/GoogleService-Info.plist", "GoogleService-Info.plist"));
    proj.WriteToFile(projPath);
}

}

It copies the file to the root of the project and sets the correct target.

If you do this and add the URL scheme as described above, you should be fine.

xmx77 commented 3 years ago

Hello, i will talk about my Scenario, i spent 4 day to understand my issue. I have this issue " |clientID| for |GIDSignIn|" like you, and i am used firebase just for "Cloud message" I do everything in document (client id ,URL scheme ... etc) but still have issue.... Today i show i have two project in my google console one for (Firebase) and anther one for (credentials) and allows GoogleService-Info.plist is take (client id for Firebase not for my anther project "credentials"). that is my issue and i fixed. I hope there is no one doing like me.