Salim
Salim

Reputation: 1

Twitter posting error

I tried to post from twitter but it not posting the comments. It display Posted successfully but not done. can any one have an idea How to solve it or APIs is change for it.

Here Is code..

    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];

Upvotes: 0

Views: 731

Answers (1)

Aman Aggarwal
Aman Aggarwal

Reputation: 3754

Use mgtwitterengine for posting tweets from your application..

Upvotes: 1

Related Questions