我正在尝试发布到朋友墙,但它不起作用。我可以张贴到我的墙上。
- (void)publishStory
{
NSString *graph=@"me/feed";
if([self.friendId length]!=0){
graph=[NSString stringWithFormat:@"%@/feed", self.friendId];
}
self.postParams = [@{
@"link" : self.link,
@"picture" : self.imageUrl,
@"name" :self.name,
@"caption" :self.caption,
@"description" : self.postMessageTextView.text
} mutableCopy];
[FBRequestConnection
startWithGraphPath:graph
parameters:self.postParams
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
NSString *alertText;
if (error) {
NSLog(@"Error publish %@", error.localizedDescription);
alertText = [NSString stringWithFormat:
@"error: domain = %@, code = %d",
error.domain, error.code];
} else {
alertText = @"Posted to Facebook. Thank you";
}
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil]
show];
}];
}
这是错误。
body = {
error = {
code = 200;
message = "(#200) The user hasn't authorized the application to perform this action";
type = OAuthException;
};
};
code = 403;