Ios Google Plus登录-提供用户电子邮件重定向至浏览器/Google Plus应用程序
在调用[self.signIn authenticate]之前,是否有办法向GPPSignIn对象提供用户电子邮件;所以用户不必在浏览器/Google Plus应用程序中输入它,就可以使用Google帐户登录?我想将用户电子邮件传递到登录表单,这样用户只需输入密码。我会提前向用户索要电子邮件,所以在大多数情况下,我可以用它来帮助他以更少的步骤登录。self.signIn.userEmail是只读的,因此不会对我有多大帮助。如果不是第一次,用户需要输入电子邮件和密码Ios Google Plus登录-提供用户电子邮件重定向至浏览器/Google Plus应用程序,ios,objective-c,iphone,google-plus,Ios,Objective C,Iphone,Google Plus,在调用[self.signIn authenticate]之前,是否有办法向GPPSignIn对象提供用户电子邮件;所以用户不必在浏览器/Google Plus应用程序中输入它,就可以使用Google帐户登录?我想将用户电子邮件传递到登录表单,这样用户只需输入密码。我会提前向用户索要电子邮件,所以在大多数情况下,我可以用它来帮助他以更少的步骤登录。self.signIn.userEmail是只读的,因此不会对我有多大帮助。如果不是第一次,用户需要输入电子邮件和密码 - (IBAction)Btn
- (IBAction)Btn_gogleShare:(id)sender {
if ([[GPPSignIn sharedInstance] authentication]) {
NSLog(@"share");
[self GoogleShare];
} else {
NSLog(@"Login");
[self GoogleLogin];
}
}
pragma标记-谷歌+所有活动
#pragma mark - Google+ Login
- (void)GoogleLogin{
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.shouldFetchGoogleUserEmail = YES; // Uncomment to get the user's email
// You previously set kClientId in the "Initialize the Google+ client" step
signIn.clientID = kClientID;
signIn.scopes = @[ kGTLAuthScopePlusLogin ];
//signIn.scopes = @[ @"profile" ]; // "profile" scope
// Optional: declare signIn.actions, see "app activities"
signIn.delegate = self;
[signIn authenticate];
[self showLoadingView:@"Authorizing..."];
}
- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth
error: (NSError *) error {
NSLog(@"Received error %@ and auth object %@",error, auth);
// NSLog(@"%@", signIn.authentication.userEmail);
[self hideLoadingView];
[self GoogleShare];
}
#pragma mark - Google+ share
- (void)GoogleShare{
id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
// This line will fill out the title, description, and thumbnail from
// the URL that you are sharing and includes a link to that URL.
[shareBuilder setURLToShare:[NSURL URLWithString:@"https://www.example.com/restaurant/sf/1234567/"]];
[shareBuilder open];
}
#pragma mark - Google+ signOut
- (void)signOut {
[[GPPSignIn sharedInstance] signOut];
}
我想知道是否可以将用户电子邮件传递到登录表单,这样用户只需输入密码。我想减少用户必须执行的步骤数。用户电子邮件对于每个用户都是不同的,因此它将如何帮助用户。我发现,如果用户已经登录到该手机的浏览器或应用程序,那么它将为您提供使用该手机的选项或添加nextI ask user以获取其电子邮件的选项,因此在大多数情况下,我都可以使用它。您的代码很有用,但它并不完全是我想要的。很抱歉,我无法提供您想要的内容