Permissions are not updated after requestNewPublishPermissions

I am trying to make my application look like a facebook page. To do this, I request permission publish_actions:

[[FBSession activeSession] requestNewPublishPermissions:@[@"publish_actions"]
                                          defaultAudience:FBSessionDefaultAudienceFriends
                                        completionHandler:nil];

Then, to like the page I call:

[FBRequestConnection startWithGraphPath:@"PAGE_ID/likes"
                           parameters:@{@"access_token" : [FBSession activeSession].accessTokenData.accessToken}
                           HTTPMethod:@"POST"
                    completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                      NSLog(@"%@", error);
                    }];

The problem is that when I look at it [FBSession activeSession].permissions, it contains only @"emailwhat I requested earlier.

Error printed by a similar call:

permissions:(
email
)>, com.facebook.sdk:ParsedJSONResponseKey=<CFBasicHash 0x944ee10 [0x214eb48]>{type = mutable dict, count = 2,
entries =>
1 : <CFString 0x27c2cc [0x214eb48]>{contents = "code"} = <CFNumber 0x9446260 [0x214eb48]>{value = +400, type = kCFNumberSInt32Type}
2 : <CFString 0x273e1c [0x214eb48]>{contents = "body"} = <CFBasicHash 0x944e650 [0x214eb48]>{type = mutable dict, count = 1,
entries =>
11 : <CFString 0x944ed50 [0x214eb48]>{contents = "error"} = <CFBasicHash 0x944e3f0 [0x214eb48]>{type = mutable dict, count = 3,
entries =>
2 : <CFString 0x943c0c0 [0x214eb48]>{contents = "type"} = <CFString 0x944e890 [0x214eb48]>{contents = "OAuthException"}
3 : <CFString 0x944e830 [0x214eb48]>{contents = "message"} = <CFString 0x944e7a0 [0x214eb48]>{contents = "(#3) Application does not have the capability to make this API call."}
6 : <CFString 0x944ec70 [0x214eb48]>{contents = "code"} = 3

However, I can post content on the user's timeline.

How can I make a similar call?

+5
source share

All Articles