首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Instagram API认证时,gtm-oauth2在Mac上崩溃

使用Instagram API认证时,gtm-oauth2在Mac上崩溃
EN

Stack Overflow用户
提问于 2014-03-18 01:41:42
回答 1查看 432关注 0票数 3

我正在构建一个小型Instagram客户端,供个人在Mac上使用。我目前正在使用gtm-oauth2从Instagram获得一个oauth2令牌。我按照源代码提供的指南来获得这个令牌。我有90%都在工作。webView加载身份验证详细信息,我可以输入我的帐户,权限屏幕出现,询问我是否愿意授予我的应用程序访问权限。我遇到的问题是,在对应用程序进行身份验证之后,无论我是“允许”还是“取消”,应用程序都会崩溃,没有堆栈跟踪或其他信息。关于例外情况,我得到的唯一信息是"Thread 1: EXC_BAD_ACCESS (code = 1,address=0x4c1)“,而且线程似乎正在与WebCore::ResourceLoader有关,但是它是一堆ASM,所以我不知道这个调用是在哪里发生的。也许我没有正确地调用windowController?我的代码包括在下面。

代码语言:javascript
复制
- (void)signIntoInstagram {

NSURL *tokenURL =[NSURL URLWithString:kTOKENIURl];

// Set up the OAuth request

GTMOAuth2Authentication *auth = [GTMOAuth2Authentication
                                 authenticationWithServiceProvider:@"Instagram"
                                 tokenURL:tokenURL
                                 redirectURI:kREDIRECTURI
                                 clientID:KCLIENTID
                                 clientSecret:KCLIENTSERCRET
                                 ];

// Specify the appropriate scope string, if any, according to the service's API documentation
auth.scope = @"basic";

NSURL *authURL = [NSURL URLWithString:KAUTHURL];

// Display the authentication view
GTMOAuth2WindowController *windowController;
windowController = [GTMOAuth2WindowController controllerWithAuthentication:auth
                                                          authorizationURL:authURL
                                                          keychainItemName:kKeychainItemName
                                                            resourceBundle:nil];

// optional: display some html briefly before the sign-in page loads
NSString *html = @"<html><body><div align=center>Loading sign-in page...</div></body></html>";
[windowController setInitialHTMLString:html];

[windowController signInSheetModalForWindow:_window
                                   delegate:self
                           finishedSelector:@selector(windowController:finishedWithAuth:error:)];}

如果我在windowController:finishedWithAuth:error: method中插入一个断点,应用程序就会到达它。但是,在我运行完之后,它仍然会崩溃,在我看来,这似乎是某种导致错误的异步操作。希望我只是在这里错过了一些简单的东西;我无法想象谷歌的OAuth项目有一个重大的缺陷。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-25 18:14:12

https://groups.google.com/forum/#!msg/gtm-oauth/N6jlOpL9k5g/n4TdrTJyxzcJ遇到同样的问题后,我在谷歌上发现了这个问题。还有一个为it记录的问题,https://code.google.com/p/gtm-oauth/issues/detail?id=11

基本上,我注释掉了GTMOAuth2WindowController.m的第331行,并且它工作了。你也可以把你的选票添加到这个问题上,也许谷歌会解决这个问题。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22468877

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档