Twitter发布错误

时间:2011-05-09 07:43:39

标签: iphone objective-c ios twitter

我试图从Twitter发帖但是没有发表评论。 它显示已成功发布但未完成。 任何人都有一个想法如何解决它或API是它的变化。

这是代码..

    OAConsumer  *consumer = [[OAConsumer alloc] initWithKey:consumerKey secret:consumerSecret];
    OAMutableURLRequest *request = [[[OAMutableURLRequest alloc] initWithURL:url1 consumer:consumer token:nil realm:nil signatureProvider:nil] autorelease];
    if (!request) return;
    [request setHTTPMethod: @"POST"];
    [request setParameters: [NSArray arrayWithObject: [[[OARequestParameter alloc] initWithName: @"oauth_callback" value:kLinkedInCallbackUrl] autorelease]]];

    OADataFetcher *fetcher = [[[OADataFetcher alloc] init] autorelease];
    [fetcher fetchDataWithRequest:request delegate:self didFinishSelector: @selector(setRequestToken:withData:) didFailSelector: @selector(outhTicketFailed:data:)];

    NSString *appendURL;
    appendURL = [NSString stringWithFormat:@"?oauth_token=%@", _requestToken.key];
    NSURL *url2 = [NSURL URLWithString:[authorizeURL stringByAppendingString:appendURL]];

    //if (!_consumerKey && _consumerSecret) return nil;    // we need a valid request token to generate the URL

    request = [[[OAMutableURLRequest alloc] initWithURL:url2 consumer:consumer token:_requestToken realm:nil signatureProvider: nil] autorelease];

    [request setParameters:[NSArray arrayWithObject: [[[OARequestParameter alloc] initWithName: @"oauth_token" value:_requestToken.key] autorelease]]];

    //SET accessTOKEN key and secret
    fetcher = nil;
    fetcher = [[[OADataFetcher alloc] init] autorelease];
    [fetcher fetchDataWithRequest:request delegate:self didFinishSelector: @selector(setAccessToken:withData:) didFailSelector: @selector(outhTicketFailed:data:)];

    //Load WebView
   //   _webView.alpha = 100.0;
    [_webView loadRequest:request];

1 个答案:

答案 0 :(得分:1)

使用mgtwitterengine从您的应用程序发布推文..