【问题标题】:Twitter: Authentication changed? App crashes suddenly on authentication window (Titanium)Twitter:身份验证改变了?应用程序在身份验证窗口突然崩溃(钛)
【发布时间】:2011-08-15 07:46:24
【问题描述】:

我的应用程序上的 Twitter 部分突然不再工作了。当我想验证应用程序崩溃时。我快速浏览了要登录的弹出窗口(具有新布局),它崩溃并出现以下错误:

http://www.pastie.org/1846358

昨天运行良好,所以我猜是身份验证窗口的新布局有问题吗?我真的无法在输出中找到问题所在,除了它给出了关于 html 内容的错误。

谁能帮帮我?或者有没有人有同样的问题,并确认我不是唯一的?

我正在使用 Titanium SDK 1.6.2 和 iPhone SDK 4.2。

谢谢!

【问题讨论】:

  • 问题解决了,认证窗口变回原来的那个了。谁能解释这种行为?如果应用发布后这种情况会再次发生,那就太烦人了。我有一个完全不同的弹出屏幕来授权您使用 twitter 的应用程序帐户。一个小时后,它又变回了正常的。
  • 您是否尝试过在 Twitter 支持处四处打听,他们控制着整个事情。

标签: iphone authentication twitter crash titanium


【解决方案1】:

如果您使用 MGTwitterEngine,请转到 SA_OAuthTwitterController.m。并改变这个:

- (void) webViewDidFinishLoad: (UIWebView *) webView {
NSError *error;
NSString *path = [[NSBundle mainBundle] pathForResource: @"jQueryInject" ofType: @"txt"];
NSString *dataSource = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding       error:&error];

if (dataSource == nil) {
    //YFLog(@"An error occured while processing the jQueryInject file");
}

//DLog(@"%@", [_webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].innerHTML"]);
[_webView stringByEvaluatingJavaScriptFromString:dataSource]; //This line injects the jQuery to make it look better
//check for auth_pin element
NSString *authPin = [[_webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('oauth_pin').innerHTML"] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
authPin = [[_webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('oauth_pin').getElementsByTagName('kbd')[0].getElementsByTagName('code')[0].innerHTML"] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (authPin.length == 0)
    authPin = [[_webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('oauth_pin').getElementsByTagName('a')[0].innerHTML"] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
//if the auth pin not found than check for the auth-pin elenent
if (authPin == nil || authPin.length == 0) {
    authPin = [[_webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('oauth-pin').innerHTML"] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    if (authPin.length == 0) {
        authPin = [[_webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('oauth-pin').getElementsByTagName('a')[0].innerHTML"] stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    }
}
[_activityIndicator stopAnimating];
if (authPin.length) {
    [self gotPin: authPin];
} 
if ([_webView isLoading] || authPin.length) {
    [_webView setHidden:YES];
} else {
    [_webView setHidden:NO];
}
}

【讨论】:

    猜你喜欢
    • 2020-04-13
    • 1970-01-01
    • 2015-06-10
    • 2011-09-21
    • 1970-01-01
    • 2013-06-13
    • 1970-01-01
    • 2018-12-23
    • 1970-01-01
    相关资源
    最近更新 更多