0

I am new to iOS programming and Objective-C. I need to code a simple application which will tweet from a specific Twitter account. I have been using a View-based application template for coding the application and I followed this tutorial in order to use the MGTwitterEngine.

As you can probably see, the tutorial uses a single View Controller to send the tweet through the engine and onto Twitter. The problem with this is that my application needs to have a welcome-view, then a "write-your-tweet" view, and then finally the "tweet-confirmation" view so the tweet can be sent. Unfortunately when I code it like that, the MGTwitterEngine doesn't send the tweet if it is not on the first View Controller.

I have tried also to add a method in the first View Controller @interface and @implementation files. which then can be called by the other View Contollers. like this:

-(void)tweetfix {
[_engine sendUpdate:@"prueba tweetfix"];
[self updateStream:nil];

But that doesn't work either. What can I do so I can tweet from those other "Views" that are not the first View Controller. Thank you for your attention.

BlueJoeCo
  • 1
  • 1

1 Answers1

0

Try adding the code to your app delegate. You can get a handle on your app delegate like this:

myAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate postTweet: "TWEET!"];
jaywayco
  • 5,846
  • 6
  • 25
  • 40