我正在尝试使用OAuth连接到我的iphone应用中的twitter。我已设置好所有内容并弹出登录弹出窗口,但登录后,它会重定向到我的回调网址。点击取消按钮只需重新打开登录屏幕。如何创建回调网址以使应用关闭登录屏幕并允许用户发送推文?提前致谢
答案 0 :(得分: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;
}
}
希望它能解决你的问题...