我有一个包含以下代码的共享按钮:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL fileURLWithPath:appFile];
FBSDKShareButton *shareButton = [[FBSDKShareButton alloc] init];
shareButton.shareContent = content;
shareButton.center = CGPointMake(60, 60);
我看到我的分享按钮变灰了。因此,我检查我的访问令牌,它返回null:
NSString *fbAccessToken = [FBSDKAccessToken currentAccessToken].tokenString;
NSLog(@"fbAccessToken %@", fbAccessToken);
根据here,我需要先调用它(我已经在AppDelegate的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
中实现了它)
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions]
但是,它返回否,并且根据FB的doc:
@从UIApplicationDelegate应用程序中调用此方法:didFinishLaunchingWithOptions:应用程序的AppDelegate方法。为了正确使用Facebook,应该调用它。 @如果url是为Facebook准备的,请返回YES,如果不是,则不返回。
我想知道为什么它返回不,也许,结果是我的accessToken为零。有人能给我建议吗?
更新
我已经登录,获得了令牌,允许从我的登录FB帐户中获得权限,但是按钮仍然是灰色的。
发布于 2017-05-17 10:12:07
对于Android,人们需要安装版本7.0或更高版本的Android应用程序的本地Facebook
也许在iOS上也是一样的。
https://stackoverflow.com/questions/37407968
复制相似问题