0

我正在使用GTL 框架将 Google Plus 集成到我的可可应用程序中。

当我尝试插入一个新时刻时,它失败并出现错误 401(未经授权)。在这篇文章中,TO 通过request_visible_actions在将用户重定向到授权页面时包含参数来解决此问题。但是怎么做呢?

我得到了一个GTMOAuth2WindowController自动创建 URL 的实例。那么如何添加request_visible_actions参数呢?如果不可能,如何创建整个 URL?

4

1 回答 1

3

我解决了这个问题!我必须创建GTMOAuth2WindowController这样的:

GTMOAuth2Authentication *auth = [GTMOAuth2SignIn standardGoogleAuthenticationForScope:kGTLAuthScopePlusLogin clientID:kClientID clientSecret:kClientSecret];
NSString *authURLString = [[[GTMOAuth2SignIn googleAuthorizationURL] absoluteString] stringByAppendingString:@"?request_visible_actions=http://schemas.google.com/AddActivity"];

NSBundle *frameworkBundle = [NSBundle bundleForClass:[GTMOAuth2WindowController class]];
GTMOAuth2WindowController *windowController = [GTMOAuth2WindowController controllerWithAuthentication:auth
                                                                                                       authorizationURL:[NSURL URLWithString:authURLString]
                                                                                                          keychainItemName:nil
                                                                                                           resourceBundle:frameworkBundle];
于 2013-08-16T15:07:33.787 回答