【问题标题】:Twitter OAuth iPhone and Navigation ControllersTwitter OAuth iPhone 和导航控制器
【发布时间】:2011-08-25 12:43:50
【问题描述】:

我是 Objective-C 和 iPhone 编程的新手,所以请多多包涵。我正在使用 bengottlieb 的 Twitter OAuth 引擎,但我不知道如何从模式视图或导航控制器中加载登录。

这会将初始屏幕推送到导航控制器中,但不会发生其他任何事情。

SA_OAuthTwitterController *twitterVC = [[SA_OAuthTwitterController alloc] init];
[self.navigationController pushViewController:twitterVC animated: YES];

.. 所以我想我必须使用这样的东西:

if(_engine)return;
    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
    _engine.consumerKey    = kOAuthConsumerKey;
    _engine.consumerSecret = kOAuthConsumerSecret;  

SA_OAuthTwitterController *twitterVC = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
[self.navigationController pushViewController:twitterVC animated: YES];

(什么都不做)

任何帮助将不胜感激。

【问题讨论】:

  • 你确定代码在下面运行 if(_engine)return; ?在 [self.navigationController pushViewController:twitterVC animated: YES] 上设置断点;看看它是否被执行。
  • 使用: if (_engine != nil) { ....... }
  • 好的,代码现在正在执行,但是我在控制台中收到了这个警告:应用程序试图在目标 上推送一个 nil 视图控制器

标签: iphone twitter oauth uinavigationcontroller


【解决方案1】:

在与 Ben 本人协商后,他说 twitter 引擎并非设计为从模式或导航视图加载。我的 Twitter 登录页面不在主视图上,而是在一个单独的视图上,因此我使用 NSNotifications 将数据从第二个视图传递到在第一个视图上初始化的引擎。

【讨论】:

    猜你喜欢
    • 2019-11-24
    • 1970-01-01
    • 2011-04-15
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多