2011-05-14 104 views
0

我是Objective-C和iPhone編程的新手,請耐心等待。我使用bengottlieb的Twitter OAuth引擎,我無法弄清楚如何從模式視圖或導航控制器加載登錄。Twitter OAuth iPhone和導航控制器

這會將啓動畫面推入導航控制器,但沒有其他事情發生。

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]; 

(這什麼都不做)

任何幫助將不勝感激。

+0

確定代碼運行在if(_engine)return; ?在[self.navigationController pushViewController:twitterVC animated:YES]上設置一個斷點;看它是否被執行。 – 2011-05-14 14:10:08

+0

使用:if(_engine!= nil){.......} – 2011-05-14 14:53:48

+0

好吧,代碼現在正在執行,但我在控制檯中得到了這個警告:應用程序試圖推送一個無視圖控制器 2011-05-14 17:56:38

回答

0

在與Ben親自協商之後,他表示Twitter引擎不適合從模式或導航視圖加載。我的Twitter登錄頁面不在主視圖中,但在單獨的視圖中,因此我使用NSNotifications將數據從第二個視圖傳遞到在第一個視圖上初始化的引擎。