开发者

Need help to post tweets from another viewcontroller

开发者 https://www.devze.com 2023-03-18 21:55 出处:网络
I am Using Outh to add Twitter to my app. Below are two UIViewControllers for login and posting tweets respectively.

I am Using Outh to add Twitter to my app.

Below are two UIViewControllers for login and posting tweets respectively.

1.SettingViewcontroller 2.DetailViewcontroller

This code for login to twitter with 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];

   DetailViewcontroller *detobj=[[DetailViewcontroller alloc]init];

 detobj.detail_enginne=_engine; 

   [detobj release];

    [self presentModalViewController: controller animated: YES];
   }
  if(!sender.on)
  { 

NSLog(@"Logout section");

    }
}

And In DetailViewcontroller Iam doin开发者_运维知识库g like this for posting.

    if(buttonIndex == 1)
{

    if(detail_enginne!=nil) 
    { 
      NSLog(@"engine availble");

               NSString *str=@"hai twitterrrrrrrrrrr";

             [detail_enginne sendUpdate:str];

    }
    else{
        NSLog(@"Engine not availabele");
             }  
}

Here Iam unable to send tweets from DetailViewcontroller. How to achive this?


in DetailViewcontroller.m

#import "SettingViewcontroller.h"

replace

 [_enginnne sendUpdate:str];

to

[[[self parentViewController] _enginnne] sendUpdate:str];
0

精彩评论

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

关注公众号