2012-08-07 77 views
0

希望你能幫助我解決這個錯誤。Xcode的臉書連接爲iPhone

  1. 我已經從GIT存儲庫下載了SDK。
  2. 我已經在我的Xcode 4.2項目中複製了/ SRC /。
  3. 我有這樣的代碼上AppDelegate.h

    #import <UIKit/UIKit.h> 
    #import "FBConnect.h" 
    
    @class ViewController; 
    
    @interface AppDelegate : UIResponder <UIApplicationDelegate,FBSessionDelegate> { 
        Facebook *facebook; 
    } 
    
    @property (strong, nonatomic) UIWindow *window; 
    @property (strong, nonatomic) ViewController *viewController; 
    @property (nonatomic, retain) Facebook *facebook; 
    
    @end 
    
  4. 我有AppDelegate.m此代碼

    #import "AppDelegate.h" 
    #import "ViewController.h" 
    
    @implementation AppDelegate 
    
    @synthesize window = _window; 
    @synthesize viewController = _viewController; 
    @synthesize facebook; 
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    { 
    
        self.window.rootViewController = self.viewController; 
        [self.window makeKeyAndVisible]; 
    
        facebook = [[Facebook alloc] initWithAppId:@"HERE_APP_ID" andDelegate:self]; 
    
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    
        if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) { 
         facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; 
         facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; 
        } 
    
        if (![facebook isSessionValid]) { 
         [facebook authorize:nil]; 
        } 
    
        return YES; 
    } 
    
    - (BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url { 
        return [facebook handleOpenURL:url]; 
    } 
    
    
    -(void) fbDidLogin { 
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
        [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; 
        [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; 
        [defaults synchronize]; 
    
    } 
    
  5. 我的.plist文件配置了我的fb「HERE_MY_APP_ID」

  6. 我的項目結構是
  • MyProject的
    • SRC
    • AppDelegate.h
    • AppDelegate.m
    • MainStoryboard.storyboard
    • ViewController.h
    • ViewController.m
    • 支持文件
  • 框架
  • 產品

的事情是,我沒有任何錯誤,但是當我運行我得到了很多的他們。近81,並警告。希望您能夠幫助我。謝謝。

enter image description here

+1

您的項目使用ARC,Facebook SDK不。它告訴你方法'-release'不可用。您需要查看禁用FB SDK上的ARC處理。 – Jessedc 2012-08-07 23:23:22

+0

@Jessedc可能會更好地發佈這個答案。否則,人們會浪費時間閱讀這個問題,認爲沒有人發佈答案,只有意識到你做了評論! – idz 2012-08-07 23:37:46

+0

@idz我對我的上述評論的迴應是,OP可能需要更好地描述ARC是什麼,如何禁用它等等。 – Jessedc 2012-08-08 00:00:47

回答

1

從我可以看到你的項目使用ARC和Facebook的SDK是沒有的。它告訴你方法-release不可用,因此您需要查看爲Facebook SDK禁用ARC。