Reputation: 117
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];
Upvotes: 2
Views: 2536
Reputation: 21967
the first comment is the right answer. When you do:
FaceViewController *FaceViewController = [[FaceViewController alloc] init];
You've redefined FaceViewController
to be an instance variable within the current scope so alloc
is being sent to the instance which doesn't have a an alloc
method. Change your instance var name and it will work. The convention is to start with lower case for variable names e.g. faceViewController
.
Upvotes: 6