2012-04-12 5 views
0

ich die Anweisung in diesem Link https://developers.facebook.com/docs/mobile/ios/build/Facebook iOS SDK kippt Arbeit mit iOS5 und Storyboard

gefolgt, und ich habe eine iOS Facebook SDK statische Bibliothek erstellt ,,, der Compiler hält auf sagen, es gibt Probleme mit dem iniWithAppId und Delegatmethode

Fehlerprotokoll

2012-04-12 14: 11: 10,569 comman [2609: F803] - [Book initWithAppId: withDelegate]: unerkannte Selektor Instanz gesendet 0x68970e0

01.235.

2012-04-12 14: 11: 10.572 comman [2609: f803] * Beenden der App aufgrund der nicht abgefangenen Ausnahme 'NSInvalidArgumentException', Grund: '- [Facebook initWithAppId: withDelegate:]: nicht erkannter Selektor an Instanz 0x68970e0 gesendet'

* ersten Wurf Call-Stack: (0x13d7052 0x1568d0a 0x13d8ced 0x133df00 0x133dce2 0x209a 0x2c9d6 0x2d8a6 0x3c743 0x3d1f8 0x30aa9 0x12c1fa9 0x13ab1c5 0x1310022 0x130e90a 0x130ddb4 0x130dccb 0x2d2a7 0x2ea9b 0x1ff2 0x1f65)

eine exceptionsharedlibrary gelten lasteten Regeln genannt terminate werfen alle

Aktuelle Sprache: auto; derzeit 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 

oben ist mein AppDelegate Header und hier ist meine AppDelegate Implementierungsdatei

#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; 
} 

das Verfahren auf der Facebook-Entwickler nur Anzug demonstriert für xcode 4 oder ios 4.3? kann mir jemand einige Ratschläge geben, wie man Klassen für ios5 Storyboard schreibt: 3

Antwort

0

Ich habe dies gestern selbst implementiert und es funktionierte perfekt (statische Facebook-Bibliothek, mit Storyboards). Der einzige Unterschied, den ich sehen kann (was ein Problem verursacht), ist, dass Sie anrufen:

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

und ich rufe:

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

Ich glaube, den Fehler withDelegate anstelle von andDelegate wird Ihnen diesen Fehler geben.

+2

OMG>

1
static NSString* kAppId = @"yourAppId"; 

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