[英]Twitter + OAuth + iPhone = fustration
I'm trying to implement http://github.com/bengottlieb/Twitter-OAuth-iPhone/tree/master into my code. 我正在尝试在我的代码中实现http://github.com/bengottlieb/Twitter-OAuth-iPhone/tree/master 。 I'm following the Demo provided and I can't seem to get it to work. 我正在跟踪提供的演示,但似乎无法正常工作。 Here is where I think the problem is currently. 我认为这是当前问题所在。
So the example declares a view controller that handles the OAuth Connections and such in the app delegates header like so: 因此,该示例在应用程序委托标头中声明了一个用于处理OAuth连接的视图控制器,如下所示:
app delegate header: 应用程序委托标头:
#import <uikit/uikit.h>
@class OAuthTwitterDemoViewController;
@interface OAuthTwitterDemoAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
OAuthTwitterDemoViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet OAuthTwitterDemoViewController *viewController;
@end
The app delegate impl: 应用程序委托隐含:
@implementation OAuthTwitterDemoAppDelegate
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:viewController.view]; <------------------------
[window makeKeyAndVisible];
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end
So as you can see where the arrow is that we never do an initWithNib or plain init, we just straight add it's view to the window. 因此,正如您看到的箭头所示,我们从不执行initWithNib或纯init,我们只需将其视图直接添加到窗口即可。
What gets called on the viewController is: 在viewController上调用的是:
OAuthTwitterDemoViewController OAuthTwitterDemoViewController
- (void) viewDidAppear: (BOOL)animated {
if (_engine) return;
_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate: self];
_engine.consumerKey = kOAuthConsumerKey;
_engine.consumerSecret = kOAuthConsumerSecret;
[_engine requestRequestToken];
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];
if (controller)
[self presentModalViewController: controller animated: YES];
else {
[_engine sendUpdate: [NSString stringWithFormat: @"Already Updated. %@", [NSDate date]]];
}
}
So basically in my example this never gets called, but in the demo it does. 因此,基本上在我的示例中,从未调用过此方法,但在演示中却是如此。 I'm confused as to what I might need to do to get this working. 我很困惑我可能需要做些什么才能使它正常工作。 I'm wondering since the viewController is an IBOutlet in the app delegates header that I may have to do something in Interface Builder, but I'm not sure what. 我想知道,由于viewController是应用程序委托标头中的IBOutlet,我可能必须在Interface Builder中执行某些操作,但是我不确定是什么。
Any help would be appreciated!!! 任何帮助,将不胜感激!!!
We're just using the standard View Based application template for the demo; 我们仅在演示中使用标准的基于视图的应用程序模板; are you using that or something else? 您在使用那个还是其他? Is your OAuthTwitterDemoViewController ever getting instantiated (ie, does viewController have a value, or is it 0x0, in your applicationDidFinishLaunching:)? 是否曾经实例化过您的OAuthTwitterDemoViewController(即,在applicationDidFinishLaunching:中,viewController是否有一个值,或者它是0x0)?
It's unclear what's working in your project and what isn't. 目前尚不清楚您的项目中有什么工作,有哪些没有。 Could you clarify that a bit? 您能否澄清一下?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.