以前已经问过/回答过某种形式的问题,但我对这个问题仍然很模糊。我正在尝试发布到朋友提要,但在尝试使用 startWithGraphPath:时不断收到“错误 com.facebook.sdk 代码 = 5”错误:来自新的 FB SDK for ios。FBSession 处于活动状态且打开,并且 access_token 似乎是正确的......这是一些代码:
-(void)inviteUser:(NSString *)whoever {
if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound) {
// No permissions found in session, so ask for it
[FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"] defaultAudience:FBSessionDefaultAudienceFriends completionHandler:^(FBSession *session, NSError *error) {
if (!error){
[self sendInvite:whoever];
}
}
}];
}
-(void) sendInvite:(NSString *)whoever {
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
@"A name of something", @"name",
nil];
[FBRequestConnection
startWithGraphPath:[NSString stringWithFormat:@"%@/feed", whoever]
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
NSString *alertText;
if (error) {
alertText = [NSString stringWithFormat:
@"error: domain = %@, code = %d",
error.domain, error.code];
} else {
alertText = @"Posted successfully.";
}
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}];
我还是新手,可能缺少一些基本的东西。但我只是没有看到它。