Facebooklogin使用FBloginView不显示在iOS 6

我正在尝试使用FBloginView为Facebook创buildloginbutton。 以下是我写的代码。

- (void)viewDidLoad { [super viewDidLoad]; if(!loginview) loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions, user_photos,status_update"]]; // Whatever permissions you need loginview.frame = self.view.bounds; //whatever you want loginview.delegate = self; [self.view addSubview:loginview]; // Do any additional setup after loading the view from its nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView { NSLog(@"Logged In"); } - (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user { NSLog(@"user Id %@",user.id); } - (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView { // Called after logout NSLog(@"Logged out"); } 

但它没有显示loginbutton。 我的代码有什么问题。 在控制台中正在“退出”。

我添加了FacebookSDKResources.bundle,但仍然出现xcode输出窗格中出现错误“界面生成器中的未知类FBLoginView”。

为了解决这个问题,我把下面一行加到了didFinishLaunchingWithOptions中:

 [FBLoginView class]; 

这在https://developers.facebook.com/ios/login-ui-control/中有解&#x91CA;

正如上面的@rajath所指出的,解决scheme是将FacebookSDKResources.bundle添加到您的项目中。