开发者

Unable to post tweets from another viewcontroller

I am Using Outh to add Twitter to my app

Basically I am using two different UIViewControllers.

  1. SettingViewcontroller
  2. DetailViewcontroller

My app is login to twitter account with SettingViewcontroller.

If I use only one UIViewController, I am able to post the tweets. But as per my requirement, I need post from DetailViewcontroller. I also declare my consumer and secret in DetailView's method but tweets are not posting to twitter from this UIViewController.

login From SettingViewcontroller.

      - (void)switchAction1:(UISwitch*)sender
     {


      if (sender.on) {

   if(_engine) 
       return;

   _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];


   _engine.consumerKey = @"###";
    _engine.consumerSecret = @"###";



    UIViewController *controller = [SA_OAuthTwitterController          
    controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];
     [开发者_Python百科self presentModalViewController: controller animated: YES];



      }
    if(!sender.on)
   { 


  NSlog(@"logout");


    }

Posting tweets From Detailviewconroller

if(buttonIndex == 1)
{

    if(_engine!=nil) 
    { 
        NSLog(@"engine availble");
        NSString *str=@"hai twitterrrrrrrrrrr";
        [_engine sendUpdate:str];

    }



    else {
        NSLog(@"engine not availble");


    }


You should use the same object in which you login.(ie)You should use the same object thru which u login in setting controller for Posting tweet in Detail controller

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜