2013-01-31 24 views
-1

我想用我的iphone應用程序中的OAuth連接到twitter。我已經設置了一切,登錄彈出窗口彈出,但是登錄後,它重定向到我的回調網址。點擊取消按鈕只需重新打開登錄屏幕。如何製作回叫網址以讓應用關閉登錄屏幕並允許用戶發送推文?在此先感謝Twitter OAuth重定向到我的回調URL

+0

請提供您的代碼 – Mark

+0

您的OAth密鑰中必須存在問題,請嘗試使用另一個密碼。 – Myaaoonn

+0

您是否將您的代碼與演示項目中使用的代碼進行了比較,並查看它們是否以相同的方式工作? – MuhammadBassio

回答

0

更換下面的方法在SA_OAuthTwitterViewController.m,它應該解決您的問題(注意,我從報GitHub的頁面:)就這些問題得到了它)

- (void) webViewDidFinishLoad: (UIWebView *) webView { 
    _loading = NO; 
    //[self performInjection]; 
    if (_firstLoad) { 
     [_webView performSelector: @selector(stringByEvaluatingJavaScriptFromString:) withObject: @"window.scrollBy(0,200)" afterDelay: 0]; 
     _firstLoad = NO; 
    } else { 
     // This else clause modified to work with twitter apps that have the callback URL set: https://dev.twitter.com/apps/ 
     // Bug details: https://github.com/bengottlieb/Twitter-OAuth-iPhone/issues/79 
     [_engine requestAccessToken]; 

     if ([_delegate respondsToSelector: @selector(OAuthTwitterController:authenticatedWithUsername:)]) 
      [_delegate OAuthTwitterController: self authenticatedWithUsername: _engine.username]; 
     [self dismissModalViewControllerAnimated:YES]; 
    } 

    [UIView beginAnimations: nil context: nil]; 
    _blockerView.alpha = 0.0; 
    [UIView commitAnimations]; 

    if ([_webView isLoading]) { 
     _webView.alpha = 0.0; 
    } else { 
     _webView.alpha = 1.0; 
    } 
} 

希望它可以解決您的問題。 ..

+0

非常感謝它爲我的應用程序的工作。 – Tamnna

+0

是的..它沒有重定向,但也無法共享。 – Myaaoonn

相關問題