English 中文(简体)
如何使用SA_OAuthTwitterEngine从PIN中排出来?
原标题:How to post tweet from iPhone without PIN using SA_OAuthTwitterEngine?

我正在开发一个寄给tw子的“蓝皮”应用程序。 为此,我使用了SA_OAuthTwitterEngine + MGTwitterEngine。

我向www.twitter.com/apps登记,并通过消费者钥匙和消费者秘密来控制我的代码。

if(!_engine){
    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
    _engine.consumerKey    = slPcFUjUh5y1hex0zvEhPg;
    _engine.consumerSecret = u6ydovMdP9yeiVqDukVhIzZPgJR9XDPUwfxymzNs;  
}

UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];

if (controller){
    [self presentModalViewController: controller animated: YES];
    intTwitterFlag = 1;
}

此前曾任过特工。 我选择申请类型=客户,我的申请将产生PIN和联系。 但是,当我的申请类型发生变化时,它不能产生PIN和进入Token。

以前申请类型是用户,即提供用户名称和密码,然后控制从网上查阅我的申请,但在进入用户名称和密码后,不能驳回申请。 ModalViewController,但显示选择性和制版。

感谢你给我的时间和任何帮助。

最佳回答

更好地使用XAuth航道进行移动用具

http://dev.twitter.com/pages/xauth

检查XAuthTwitterEngine,为MGTwitterEngine安装Xauth

问题回答

这里是:合理取代SA_OAuthTwitterController.m的方法:

- (void) webViewDidFinishLoad: (UIWebView *) webView {
    _loading = NO;
    //[self performInjection];
    if (_firstLoad) {
        [_webView performSelector: @selector(stringByEvaluatingJavaScriptFromString:) withObject: @"window.scrollBy(0,200)" afterDelay: 0];
        _firstLoad = NO;
    } else {
        /*
        NSString                    *authPin = [self locateAuthPinInWebView: webView];
        NSLog(@"authPin: %@", authPin);
        if (authPin.length) {
            [self gotPin: authPin];
            return;
        }

        NSString                    *formCount = [webView stringByEvaluatingJavaScriptFromString: @"document.forms.length"];

        if ([formCount isEqualToString: @"0"]) {
            [self showPinCopyPrompt];
        }*/

        //*****************************************************
        //  This is to bypass the pin requirement 
        //  in case the call back URL is set in Twitter settings
        //*****************************************************     
        [_engine requestAccessToken];
        if ([_delegate respondsToSelector: @selector(OAuthTwitterController:authenticatedWithUsername:)])
        {
            [_delegate OAuthTwitterController: self authenticatedWithUsername: _engine.username];

        }
        [self performSelector: @selector(dismissModalViewControllerAnimated:) withObject: (id) kCFBooleanTrue afterDelay: 1.0];

        //[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;
    }
}

I too faced the same issue, and i just removed callback url from the twitter app settings. For my surprise login proceeds without any issue.

替换这种方法

(void) webViewDidFinishLoad: (UIWebView *) webView

in the class SA_OAuthTwitterController.m works well.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签