2012-06-25 2 views
2

내 APP의 페이스 북 로그인은 작동하지 않습니다.코코아 페이스 북의 로그인이 작동하지 않습니다.

.h 파일에 나는 #import "FBConnect.h"@interface MyImageViewControllerViewController : UIViewController<UINavigationControllerDelegate, FBSessionDelegate, FBRequestDelegate>을 추가했으며, 내 Facebook *facebook; iVar를 가지고 있습니다.

필요한 모든 방법을 구현합니다 (자습서에서 말했듯이). 어떻게했는지 설명합니다. 나는 facebooking 메서드를 호출 할 때 내 Facebook APP 인증 페이지에서 사파리를 시작 이제

-(BOOL)facebooking{ 
facebook = [[Facebook alloc] initWithAppId:FB_APP_ID andDelegate:self];  
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
if ([defaults objectForKey:@"FBAccessTokenKey"] 
    && [defaults objectForKey:@"FBExpirationDateKey"]) { 
    facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; 
    facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; 

} 
if (![facebook isSessionValid]) { 
    [facebook authorize:nil]; 
} 
return YES; 
} 

그리고

- (void)fbDidLogin { 
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; 
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; 
[defaults synchronize]; 

UIAlertView *a = [[UIAlertView alloc] initWithTitle:@"Token" message:[facebook accessToken] delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil]; 
[a show]; 

} 

을 (나는 그것이 무의미 할 것 같아요 사촌 내가 모든 것을 게시 실 거예요), 난 Okay를 누르십시오 내 iOS 앱으로 돌아가지만 어떤 이유로 인해 fbDidLogin이 호출되지 않습니다. 둘 다 fbDidNotLogin입니다. 어떻게 든 그들을 가리켜 줄 필요가있는 장소가 있습니까?

감사합니다.

답변

1

이 방법을 구현 했습니까?

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url 
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 
return [facebook handleOpenURL:url]; 
} 
+0

예, 그와'- (BOOL) 응용 프로그램 : (UIApplication *) 응용 프로그램의 handleOpenURL : (NSURL *) URL { 복귀 [페이스 북 handleOpenURL : 홈페이지] }' –

+0

당신은이 두 가지 메소드 중 하나를 구현해야합니다. 먼저 iOS 4.2+에서 두 번째 else – iArezki

+1

은 애플리케이션 위임에 모든 메소드를 구현하려고 시도합니다. – iArezki

관련 문제