I’m currently trying the Facebook’s single sign on function in my mobile app. So far, I could reach the Facebook Auth Dialog as I test my app. But when I click the OK button as I authorize the app, my view gives me a black screen. I wonder if this is because of the assignment of the rootViewController.

In this line of code in my FbSSOTrialDelegate.m
self.window.rootViewController = self.FbSSOTrialVC;
I get a warning saying Incompatible pointer types assigning to 'UIViewController *' from 'FbSSOTrialViewController *' and also this log in my console:
2012-07-09 11:17:04.798 FbSSOTrial[976:f803] Application windows are expected to have a root view controller at the end of application launch
I say it’s quite weird because I’m sure that FbSSOTrialVC is a subclass of UIViewController
Kindly enlighten me on why is this happening. Below were the other codes for the FbSSOTrialViewController.h
#import <UIKit/UIKit.h>
@interface FbSSOTrialViewController : UIViewController
@end
and appDelegate
FbSSOTrialDelegate.h
#import <UIKit/UIKit.h>
#import "FBConnect.h"
@class FbSSOTrialViewController;
@interface FbSSOTrialAppDelegate : NSObject <UIApplicationDelegate, FBSessionDelegate>
{
Facebook *facebook;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet FbSSOTrialViewController *FbSSOTrialVC;
@property (nonatomic, retain) Facebook *facebook;
@end
FbSSOTrialDelegate.m
#import "FbSSOTrialAppDelegate.h"
@implementation FbSSOTrialAppDelegate
@synthesize window = _window;
@synthesize facebook = _facebook;
@synthesize FbSSOTrialVC = _FbSSOTrialVC;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
NSString *FbAppId = @"MY_APP_ID";
self.window.rootViewController = self.FbSSOTrialVC;
[self.window makeKeyAndVisible];
self.facebook = [[Facebook alloc] initWithAppId:FbAppId andDelegate:self];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) {
self.facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
self.facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
if (![self.facebook isSessionValid]) {
[self.facebook authorize:nil];
}
return YES;
}
From our discussion, it was decided that the view controller was not being properly instantiated during the application launch. We determined that the ViewController of interest is coming from a storyboard, so the recommended code change is as follows:
Note that this requires that in the storyboard, the ViewController of interest should have the identifier “Fb SSO Trial VC” (change these as appropriate).