2012-04-12 57 views
0

我跟着這個鏈接 https://developers.facebook.com/docs/mobile/ios/build/iOS5的Facebook的iOS版SDK着工作和故事板

的指令,我已經創建了一個Facebook的iOS版SDK的靜態庫 ,,,編譯口口聲聲說有問題與iniWithAppId和代表方法

錯誤日誌

2012-04-12 14:11:10.569 comman [2609:F803] - [實initWithAppId:withDelegate:]:無法識別的選擇發送到實例0x68970e0

2012-04-12 14:11:10.572 comman [2609:f803] *由於未捕獲異常'NSInvalidArgumentException',原因:' - [Facebook initWithAppId:withDelegate:]:無法識別的選擇器發送到實例0x68970e0'

*第一擲調用堆棧: (0x13d7052 0x1568d0a 0x13d8ced 0x133df00 0x133dce2 0x209a 0x2c9d6 0x2d8a6 0x3c743 0x3d1f8 0x30aa9 0x12c1fa9 0x13ab1c5 0x1310022 0x130e90a 0x130ddb4 0x130dccb 0x2d2a7 0x2ea9b 0x1ff2 0x1f65)

終止叫做拋出exceptionsharedlibrary應用負載規則全部爲

當前語言:汽車;目前Objective-C的

(GDB)

#import <UIKit/UIKit.h> 
#import "FBConnect.h" 
@interface AppDelegate : UIResponder <UIApplicationDelegate, FBSessionDelegate>{ 
      Facebook *facebook; 
} 

@property (strong, nonatomic) UIWindow *window; 
@property (nonatomic, retain) Facebook *facebook; 

@end 

以上是我的應用程序委託 頭,這裏是我的應用程序委託實現文件

#import "AppDelegate.h" 

@implementation AppDelegate 


@synthesize window = _window; 
@synthesize facebook; 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    facebook = [[Facebook alloc] initWithAppId:@"215686948531995" withDelegate:self]; 

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    if([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]){ 
     facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; 
     facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; 
} 

    // NSArray *permissions = [[NSArray arrayWithObjects:@"read_stream", @"publish_stream", @"offline_access", nil]retain]; 
    if(![facebook isSessionValid]){ 
     [facebook authorize:nil]; 
    } 
    // Override point for customization after application launch. 
    return YES; 
} 

證明Facebook上的開發者只西裝的方法爲xcode 4或ios 4.3? 任何人都可以給我一些建議,如何編寫ios5故事板的類:3

回答

0

我剛剛實現了這個昨天我自己,它完美的工作(靜態Facebook庫,使用故事板)。我可以看到(這將導致一個問題),唯一的區別是,你打電話:

facebook = [[Facebook alloc] initWithAppId:@"215686948531995" withDelegate:self]; 

和我打電話:

facebook = [[Facebook alloc] initWithAppId:@"215686948531995" andDelegate:self]; 

我相信使用withDelegate代替的錯誤andDelegate會給你這個錯誤。

+2

OMG> 2012-04-14 07:57:00

1
static NSString* kAppId = @"yourAppId"; 

_facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:self];