1
我正在第一次使用引擎,而且對於iOS開發來說是相當新的。我很好奇,但是如果在我成功登錄後有一種方法可以調用函數嗎?我似乎無法順利完成FBConnect在初始登錄功能後調用fbDidLogin的行。我已經聲明瞭MGTwitterEngineDelegate,我試圖在登錄後使用以下代碼:登錄成功時運行函數MGTwitterEngine ala FBConnect
//TWITTER LOGIN FUNCTION/////////////////////
-(void)twitLogin{
NSLog(@"Inside of twitLogin...");
if(![_engine isAuthorized]){
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];
if (controller){
[self presentModalViewController: controller animated: YES];
NSLog(@"Inside of Twitter login UIWebView.");
} else {
NSLog(@"ONCE WE'RE LOGGED IN, LETS SEND THE TWEET!");
NSString *tweet = [[NSString alloc] initWithFormat:@"My Tweet!"];
[_engine sendUpdate:tweet];
NSLog(@"You just tweeted: %@",tweet);
}
} else {
NSString *twitterToken=[[NSUserDefaults standardUserDefaults] objectForKey:@"authData"];
NSLog(@"Twitter is authorized?: %@",twitterToken);
//Twitter Integration Code Goes Here
NSString *tweet = [[NSString alloc] initWithFormat:@"My Tweet!"];
[_engine sendUpdate:tweet];
NSLog(@"You just tweeted: %@",tweet);
}
}
任何幫助表示讚賞。非常感謝!