我是 iOS 编程和 Objective-C 的新手。我需要编写一个简单的应用程序,该应用程序将从特定的 Twitter 帐户发送推文。我一直在使用基于视图的应用程序模板来编码应用程序,并且遵循 本教程以便使用 MGTwitterEngine。
正如您可能看到的,本教程使用单个视图控制器通过引擎将推文发送到 Twitter。问题是我的应用程序需要有一个欢迎视图,然后是“写你的推文”视图,最后是“推文确认”视图,以便可以发送推文。不幸的是,当我这样编码时,如果 MGTwitterEngine 不在第一个视图控制器上,则它不会发送推文。
我还尝试在第一个视图控制器 @interface 和 @implementation 文件中添加一个方法。然后可以由其他视图控制器调用。像这样:
-(void)tweetfix {
[_engine sendUpdate:@"prueba tweetfix"];
[self updateStream:nil];
但这也不起作用。我能做什么,以便我可以从不是第一个视图控制器的其他“视图”发送推文。感谢您的关注。
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.
发布评论
评论(1)
尝试将代码添加到您的应用程序委托中。您可以像这样获取应用程序委托的句柄:
Try adding the code to your app delegate. You can get a handle on your app delegate like this: