推特登录出错后没有拿到错误返回
2016-12-06 14:51
453 查看
参考:http://blog.csdn.net/pz789as/article/details/53486568
前不久将推特的授权登录加入到自己的项目中来,今天测试时发现,在没有翻墙时,点击推特登录之后一直没有反应,然后看log发现,推特本身是给出了提示:
did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "" UserInfo={NSLocalizedDescription=}
但是我这边也都对error做了处理和打印,却并没有接收到错误信息,导致应用一直停在waiting状态,无法操作!
调用推特登录代码如下:
后面log在判断session外面发现,根本没有回调这个函数。
于是在网上找答案,然后在推特的论坛上找到这么一个答案:
https://twittercommunity.com/t/problem-using-twitterkit-to-login-via-oauth/73379
Thanks for reaching out on this. Have you made any customizations to the
defined in Twitter.h along with the
With the
the developer can choose which methods to use when providing the user with the ability to log in using Twitter.
个人觉得应该是登录的方式不对,于是乎,将上面的代码中的
TWTRLoginMethodWebBased
改成
TWTRLoginMethodAll
就可以拿到结果啦,它会提示timeout,这样就可以做下一步操作了!心情瞬间舒畅了很多啊
改了之后的提示是这样的:
did encounter error with message "Unable to authenticate using the system account.": Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
然后就可以弹出提示框了:
前不久将推特的授权登录加入到自己的项目中来,今天测试时发现,在没有翻墙时,点击推特登录之后一直没有反应,然后看log发现,推特本身是给出了提示:
did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "" UserInfo={NSLocalizedDescription=}
但是我这边也都对error做了处理和打印,却并没有接收到错误信息,导致应用一直停在waiting状态,无法操作!
调用推特登录代码如下:
[[Twitter sharedInstance] logInWithMethods:TWTRLoginMethodWebBased completion:^(TWTRSession* session, NSError* error) { if (session){ NSLog(@"signed in as %@", [session userName]); [self twlCallback:CB_CODE_LOGIN result: [NSString stringWithFormat:@"{\"userName\": \"%@\",\"userID\": \"%@\",\"authToken\": \"%@\",\"authTokenSecret\": \"%@\"}", [session userName], [session userID], [session authToken], [session authTokenSecret] ] ]; }else{ NSLog(@"error: %@", [error localizedDescription]); [self twlCallback:CB_CODE_ERROR result:[NSString stringWithFormat:@"{\"id\":\"%@\", \"dsc\":\"%@\"}", ERROR_LOGIN, [error localizedDescription]]]; } }];
后面log在判断session外面发现,根本没有回调这个函数。
于是在网上找答案,然后在推特的论坛上找到这么一个答案:
https://twittercommunity.com/t/problem-using-twitterkit-to-login-via-oauth/73379
Thanks for reaching out on this. Have you made any customizations to the
TWTRLoginMethodenum
defined in Twitter.h along with the
[Twitter logInWithMethods:completion:]method? By default, Twitter Kit will choose log in methods in the following order
[System Account]->
[SFSafariViewController]->
[UIWebView].
With the
TWTRLoginMethodenum,
the developer can choose which methods to use when providing the user with the ability to log in using Twitter.
个人觉得应该是登录的方式不对,于是乎,将上面的代码中的
TWTRLoginMethodWebBased
改成
TWTRLoginMethodAll
就可以拿到结果啦,它会提示timeout,这样就可以做下一步操作了!心情瞬间舒畅了很多啊
改了之后的提示是这样的:
did encounter error with message "Unable to authenticate using the system account.": Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
然后就可以弹出提示框了:
相关文章推荐
- 【已解决】接应用宝sdk:在没有装QQ的情况下QQ登录会打开页面提示下载QQ,此时返回就会报错误
- 使用cas登录出错,本地没有错误,环境上报错
- win2003 +sqlserver+sqlserversp3 客户端访问出错(跨网段出错,不然没有错误)
- 一个错误的链表程序 ——编译通过,执行出错。自己没有好的调试技术,没有找到错误;而靠经验得逐行细查——费时间
- Excel 导入 Sql Server出错——“文本被截断,或者一个或多个字符在目标代码页中没有匹配项”错误的解决
- .Net Framework 4.5.1 ASP.NET MVC 5 下新建视图报“错误 运行所选代码生成器时出错 无法检索元数据 没有为该对象定义无参数构造函数”
- 尝试向 URI“ ”发出请求时出错。这可能是由于试图以跨域方式访问服务而又没有正确的跨域策略,或策略不适用于 SOAP 服务...。出现此错误也可能是由于使用的是 Web 服务代理中的内部类型而没有使用 InternalsVisibleToAttribute 属性。
- 低级错误,返回的是正常的信息,没有查询到相应的信息
- ssh调用存储过程,console提示错误:该语句没有返回结果集。
- 在登录页面设计中输入密码错误后弹框提示并返回到登录界面的代码实现
- SQL Server 2008 R2运行分布式的查询时的错误消息:"链接服务器 < 链接服务器 > 的 OLE DB 提供程序 SQLNCLI 返回消息没有事务处于活动状态
- git登录时显示密码错误或者没有权限的解决办法
- 诡异的错误:QQ登录后就没有反应
- 对双向链表的处理,单个,但是,有错误,就是在输入越界 时候,没有执行出错处理
- Excel 导入 Sql Server出错——“文本被截断,或者一个或多个字符在目标代码页中没有匹配项”错误的解决
- 基于所提供的凭据,您没有权限查看此目录或网页;HTTP 错误 401.2 - 未授权:服务器配置导致登录失败
- OFFICE2007安装出错:“错误 1311。没有找到源文件: Y:/OFFICE11/SKU011.CAB” 的解决办法
- 段错误的第4种情况——没有返回指针
- Asp.net ashx判断是否合法请求(如未登录返回错误)
- excel 导入 sql数据库 错误如下:返回列状态:文本被截断,或者一个或多个字符在目标代码页中没有匹配项。