I wrote this code. I followed the sample application code provided with facebook SDK.
In FeceAppDelegate.m
#import "FaceAppDelegate.h"
#import "FaceViewController.h"
@implementation FaceAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize navigationController=_navigationController;
@synthesize facebook;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
FaceViewController *FaceViewController = [[FaceViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:FaceViewController];
// Initialize Facebook
facebook = [[Facebook alloc] initWithAppId:@"345678" andDelegate:FaceViewController];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
When I run, I have EXC_BAD_ACCESS , and i have a warning , “Instance method alloc not found …”
I think the problem is in
FaceViewController *FaceViewController = [[FaceViewController alloc] init];
the first comment is the right answer. When you do:
You’ve redefined
FaceViewControllerto be an instance variable within the current scope soallocis being sent to the instance which doesn’t have a anallocmethod. Change your instance var name and it will work. The convention is to start with lower case for variable names e.g.faceViewController.