FBSDKCoreKit框架,在xCode 7协议FBSDKApplicationDelegate中无法识别

时间:2015-10-04 07:22:49

标签: ios objective-c xcode facebook fbsdk

我下载了最新的Facebook SDK版本4.6 我在这里阅读了IOS SDK入门:https://developers.facebook.com/docs/ios/getting-started/

我将FBSDKCoreKit.Framework拖放到项目中,就像指南展示一样。

在AppDelegate.m的标题中,我写道:

//-----
#import <FBSDKCoreKit/FBSDKCoreKit.h>

@interface AppDelegate () <FBSDKApplicationDelegate>

@end
//----

我做了所有入门指南.... 好吧,我的问题是:

Cannot find protocol declaration 'FBSDKApplicationDelegate' did you mean 'UIApplicationDelegate'?

FBSDKCoreKit/FBSDKCoreKit.h被认可,FBSDKApplicationDelegate.h在框架内,框架搜索路径在应用程序设置中....

问题出在哪里?我找不到它

的信息: XCode 7.0, FBSdk 4.6, 部署目标9.0

1 个答案:

答案 0 :(得分:0)

您不必像以前那样实现委托。

而不是:

//-----
#import <FBSDKCoreKit/FBSDKCoreKit.h>

@interface AppDelegate () <FBSDKApplicationDelegate>

@end
//----

你需要这个

//-----
#import <FBSDKCoreKit/FBSDKCoreKit.h>

@interface AppDelegate () 

@end
//----

下一个方法中返回的值必须是

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

   // your code

  return [[FBSDKApplicationDelegate sharedInstance] application:application
    didFinishLaunchingWithOptions:launchOptions];
}

然后你必须实现这个方法:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:sourceApplication
    annotation:annotation
  ];
}

就是这样。