내 앱에 Facebook sdk를 구현하려고하지만 벽/피드 팝업에 글쓰기를 표시하는 데 문제가 있습니다. 내 앱에서 Facebook에 성공적으로 로그인 할 수 있습니다. 먼저 네이티브 페이스 북 앱으로 이동합니다. 일단 승인하면 다시 기본 앱으로 돌아가므로 아무 일도 일어나지 않습니다. 대화 상자가 나타나지 않고 만든 모든 빈보기입니다. 이것이 내 코드입니다. 왜 이것이 작동하지 않는지 아무도 모른다면 도움을 주시면 고맙겠습니다.팝업 Facebook 피드 iOS
감사
fbViewController.h
#import <UIKit/UIKit.h>
#import "FBConnect.h"
@interface fbViewController : UIViewController <UIApplicationDelegate,FBSessionDelegate,FBDialogDelegate>
{
Facebook *facebook;
}
@property (nonatomic, retain) Facebook *facebook;
@end
fbViewController.m
#import "fbViewController.h"
#define kAppId @"xxxxxxx"
- (void)viewDidLoad
{
[super viewDidLoad];
facebook = [[Facebook alloc] initWithAppId:@"xxxxxxxxxxx" 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];
}
}
- (void)fbDidLogin {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"app_id",
@"http://developers.facebook.com/docs/reference/dialogs/", @"link",
@"http://fbrell.com/f8.jpg", @"picture",
@"Facebook Dialogs", @"name",
@"Reference Documentation", @"caption",
@"Using Dialogs to interact with users.", @"description",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
}
myAppDelegate.m
// Pre iOS 4.2 support
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [facebook handleOpenUrl:url];
}
// For iOS 4.2+ support
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [facebook handleOpenURL:url];
}
[facebook dialog : andParams : andDelegate :]가 호출되도록 중단 점 설정을 시도 했습니까? –
먼저 fbDidLogIn에서 NSLog 문을 사용하고 (요청한 코드 어딘가에 요청을 보내면) didLoad : 로그인 성공 여부 및 실제로 데이터 수신 여부를 확인합니다. 실제로 로그인하여 데이터를 얻는 경우보기에 데이터를 저장하는 방법에 문제가 있습니다. 그러나 우리가 여기있는 것에서는 그것을 알 수있는 방법이 없습니다. – geraldWilliam
@Inturbidus 앱이 fbDidLogin을 절대 입력하지 않습니다. 나는 이유를 모른다. 어떤 제안? 감사합니다 –