gpt4 book ai didi

ios - Facebook SDK 4.x 权限问题 iOS

转载 作者:可可西里 更新时间:2023-11-01 04:51:11 26 4
gpt4 key购买 nike

我正在尝试为登录用户的时间线获取Feed。我有一个登录按钮,我正在向其传递读取权限,包括 user_posts。令人惊讶的是,Facebook 没有授予我此权限并忽略了它。

代码:

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.loginButton.readPermissions = @[@"public_profile", @"email", @"user_friends", @"user_posts"];

self.loginButton.delegate = self;

if([FBSDKAccessToken currentAccessToken])
{
NSLog(@"Have access token");
NSLog(@"permissions .... %@",[FBSDKAccessToken currentAccessToken].permissions);
[self retrieveFeed];
}

}

#pragma mark - Login Delegate

-(void) loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
NSLog(@"Login Successfully!!");
NSLog(@"permissions .... %@",[FBSDKAccessToken currentAccessToken].permissions);

[self retrieveFeed];

}

-(void) loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{

}

#pragma mark - Receive FB Feed

-(void) retrieveFeed
{
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/feed" parameters:nil];

FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
[connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

NSLog(@"%@",result);

if(error)
NSLog(@"Some error FEED;;;;;; %@",error.localizedDescription);
}];
[connection start];
}

单击登录按钮后,我会看到以下权限屏幕。 Facebook 已忽略 user_posts 权限。

enter image description here

即使我稍后在登录后尝试获得此权限,Facebook 也会告诉我我已经授权应用这样做,即使没有授予这样的权限!获取新权限的代码是:

-(void) checkForFeedPermission
{
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"user_posts"]) {

NSLog(@"already granted feed access");
[self retrieveFeed];

} else {
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithReadPermissions:@[@"user_posts"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

NSLog(@"requesting feed access");
[self retrieveFeed];

}];
}
}

三天来我一直在为这个问题苦苦思索。请建议我哪里错了?谢谢。

最佳答案

我认为不为 grant user_posts 工作作为标准 Facebook developer documentation for permission您必须提交您的 Facebook 应用程序以供审核,请参阅我附上清楚说明的屏幕截图。

enter image description here

所以你必须提交你的facebook app for login review可能然后您可以在登录时设置此权限

关于ios - Facebook SDK 4.x 权限问题 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29820630/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com