之前已经提出/回答了某种形式,但我对这个问题仍然很朦胧。我正在尝试发布给朋友提要,但在尝试使用startWithGraphPath时,不断收到“错误com.facebook.sdk code = 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];
}];
我还是新手,我可能会遗漏一些基本的东西。但我只是没有看到它。
答案 0 :(得分:0)
修正了它。我认为有两个问题:
顺利完成这两项变更。不过我确实有一个后续问题:如何使用新的SDK本机共享对话框在别人的墙上发帖?我可能会问这是一个单独的问题。