所以我的應用程序中的Twitter/Facebook實現已經是一個學習的經驗,但我幾乎在那裏,我有最後一個,可能很簡單的問題。使用MGTwitter引擎,我打電話從我的視圖控制器的方法方法正在調用還沒有執行
- (void) setAccessToken: (OAServiceTicket *) ticket withData: (NSData *) data {
該方法是關閉,(由NSLog調用確認)。但是,它並沒有做它應該做的事情,這在Twitter的註銷按鈕中淡化了。我仍然接觸Objective-C處理方法和所有的方式,我覺得我只是沒有將我的變量指向正確的位置。任何方向是非常讚賞,這裏是下面的代碼:
SA_OAuthTwitterEngine.m -
//
// access token callback
// when twitter sends us an access token this callback will fire
// we store it in our ivar as well as writing it to the keychain
//
- (void) setAccessToken: (OAServiceTicket *) ticket withData: (NSData *) data {
if (!ticket.didSucceed || !data) return;
NSString *dataString = [[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding] autorelease];
if (!dataString) return;
if (self.pin.length && [dataString rangeOfString: @"oauth_verifier"].location == NSNotFound) dataString = [dataString stringByAppendingFormat: @"&oauth_verifier=%@", self.pin];
NSString *username = [self extractUsernameFromHTTPBody:dataString];
if (username.length > 0) {
[self setUsername: username password: nil];
if ([_delegate respondsToSelector: @selector(storeCachedTwitterOAuthData:forUsername:)]) [(id) _delegate storeCachedTwitterOAuthData: dataString forUsername: username];
}
[_accessToken release];
_accessToken = [[OAToken alloc] initWithHTTPResponseBody:dataString];
//Call twit login from my view controller
MyView *fvController = [[MyView alloc] init];
[MyView twitLogin];
[MyView helper];
NSLog(@"LETS TWEET DIRECTLY AFTER SUCCESSFUL LOG IN!");
}
這是幫助我的方法是在我的.m文件做:
-(void)helper{
NSLog(@"HELPER FUNCTION");
[self fadeIn:twitterLogout withDuration:2 andWait:2.0];
}
這是它正在調用的方法
//FADE IN FUNCTION ------------------------------//////////////////////
-(void)fadeIn:(UIView*)viewToFadeIn withDuration:(NSTimeInterval)duration
andWait:(NSTimeInterval)wait
{
[UIView beginAnimations: @"Fade In" context:nil];
[UIView setAnimationDelay:wait];
[UIView setAnimationDuration:duration];
viewToFadeIn.alpha = 1;
[UIView commitAnimations];
}
什麼是日誌,什麼不是? – Moshe