2
我寫了這段代碼。我跟着facebook SDK提供的示例應用程序代碼。 在FeceAppDelegate.m實例方法alloc找不到
#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;
}
當我跑,我有EXC_BAD_ACCESS,和我有一個警告,「未找到實例方法頁頭......」 我認爲這個問題是在
FaceViewController *FaceViewController = [[FaceViewController alloc] init];
你應該在變量名的開頭有一個小寫字母f,例如: FaceViewController * faceViewController = [[FaceViewController alloc] init];除此之外,你可以發佈FaceViewController的頭文件聲明嗎? – MCannon
你可以把斷點,看看哪一行是給這個問題 –
哦,我很笨,謝謝你MCannon,它的工作與小寫 – Keviin55