2011-09-27 311 views
0

我正在開發一個具有Twitter登錄的應用程序。我已經整合了MGTwitterEngine,並且一切正常。從MGTwitterEngine獲取用戶詳細信息

我的問題是,當用戶登錄時,我需要一些細節 - 無論哪個信息是由MGTwitterEngine返回該登錄用戶。

當我看看庫文檔時,發現了下面的委託方法,它可能會提供一些用戶信息,但是當我登錄時,此方法永遠不會被調用。

- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier { 

    NSLog(@"User Info Received: %@", userInfo); 
} 

有人可以請建議我如何從MGTwitterEngine獲取用戶的信息或者我應該怎麼用這個方法?

_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; 
    _engine.consumerKey = @"PzkZj9g57ah2bcB58mD4Q"; 
    _engine.consumerSecret = @"OvogWpara8xybjMUDGcLklOeZSF12xnYHLE37rel2g"; 

    UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self]; 

    if (controller) 
     [self presentModalViewController: controller animated: YES]; 
    else { 
     tweets = [[NSMutableArray alloc] init]; 
     [self updateStream:nil]; 
    } 
+0

你有實際設置一個委託發動機? –

+0

@Josh是的一切工作正常。我已經設置它,但沒有得到這個方法被調用。 – Gypsa

+1

而你正在調用'getUserInformationFor:'?並沒有得到任何'requestFailed:withError:'?這可能有助於發佈重現問題的片段。 –

回答

1

,我發現我的問題的答案: -

- (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username { 

    NSLog(@"Authenticated with user %@", username); 
    [_engine getUserInformationFor:username];//this line to be added to get userInfo method called 
} 
+0

我想[我的評論](http://stackoverflow.com/questions/7564732/getting-user-details-from-mgtwitterengine)幫助你,然後呢? –

+0

@Josh Caswell是的,它給了我一些確切的功能。謝謝很多。 – Gypsa