我正在使用此处的Google登录文档:
https://developers.google.com/identity/sign-in/ios/quick-migration-guide
在2. ViewController实现文件的更改中,我在Xcode中收到错误以检索用户信息:
Intent i = new Intent(context,AlarmReceiver.class);
i.setAction(Intent.ACTION_BOOT_COMPLETED);
int id = (int) alarms_ID;
i.putExtra("_id",id);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, i, PendingIntent.FLAG_UPDATE_CURRENT);
Calender calender=...;
alarmMgr.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
登录正在运行,但没有返回用户信息。
答案 0 :(得分:0)
我看到了这个问题。迁移指南中的代码来自一个示例,它引用了该示例中的一些元素。请尝试以下方法:
GIDSignIn* signIn = [GIDSignIn sharedInstance];
signIn.shouldFetchBasicProfile = YES;
[signIn setClientID: kClientId];
[signIn setScopes:[NSArray arrayWithObject:@"https://www.googleapis.com/auth/plus.login"]];
[signIn setDelegate: self];
NSLog(@"Initialized auth2...");
顺便说一句:如果您想允许所有Google用户登录,而不仅仅是Google+用户,请删除[signIn setScopes:…]
行。