0
希望你能帮助我解决这个错误。Xcode的脸书连接为iPhone
- 我已经从GIT存储库下载了SDK。
- 我已经在我的Xcode 4.2项目中复制了/ SRC /。
我有这样的代码上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
我有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]; }
我的.plist文件配置了我的fb“HERE_MY_APP_ID”
- 我的项目结构是
- MyProject的
- SRC
- AppDelegate.h
- AppDelegate.m
- MainStoryboard.storyboard
- ViewController.h
- ViewController.m
- 支持文件
- 框架
- 产品
的事情是,我没有任何错误,但是当我运行我得到了很多的他们。近81,并警告。希望您能够帮助我。谢谢。
您的项目使用ARC,Facebook SDK不。它告诉你方法'-release'不可用。您需要查看禁用FB SDK上的ARC处理。 – Jessedc 2012-08-07 23:23:22
@Jessedc可能会更好地发布这个答案。否则,人们会浪费时间阅读这个问题,认为没有人发布答案,只有意识到你做了评论! – idz 2012-08-07 23:37:46
@idz我对我的上述评论的回应是,OP可能需要更好地描述ARC是什么,如何禁用它等等。 – Jessedc 2012-08-08 00:00:47