![](/img/trans.png)
[英]Method 'loadAceessToken' in protocol 'FHSTwitterEngineAccessTokenDelegate' not implemented
[英]Facebook API “Method in protocol not implemented”
我在AppDelegate
做了:
@interface AppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate> {
Facebook *facebook;
}
並遵循了Facebook Developers上的教程。 但是它仍然像做四遍:
1)此處聲明的方法( Facebook.h
):
- (void)fbDidNotLogin:(BOOL)cancelled;
2)直接或間接協議“ FBSessionDelegate”( AppDelegate.h
)必需:
@interface AppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate> {
Facebook *facebook;
}
有什么我忘了嗎?
謝謝!
根據Hackbook的示例,您必須添加更多方法:
- (void)storeAuthData:(NSString *)accessToken expiresAt:(NSDate *)expiresAt {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:accessToken forKey:@"FBAccessTokenKey"];
[defaults setObject:expiresAt forKey:@"FBExpirationDateKey"];
[defaults synchronize];}
-(void)fbDidNotLogin:(BOOL)cancelled{
}
-(void)fbDidExtendToken:(NSString *)accessToken expiresAt:(NSDate *)expiresAt{
NSLog(@"token extended");
[self storeAuthData:accessToken expiresAt:expiresAt];
}
- (void)fbSessionInvalidated {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Auth Exception"
message:@"Your session has expired."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil,
nil];
[alertView show];
[alertView release];
[self fbDidLogout];
}
當您的AppDelegate聲明遵循FBSessionDelegate協議時,它需要實現此協議中的所有必需方法。
因此,您需要像在AppDelegate.m中實現fbDidNotLogin方法
- (void)fbDidNotLogin:(BOOL)cancelled {
// Do something here
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.