是否可以使用iOS SLRequest和图形API“https://graph.facebook.com/me/feed”,...用于在Facebook墙上发布带有该位置的消息?
我已经实施了如下的SLRequest,
SLRequest *feedRequest = [SLRequest
requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:https://graph.facebook.com/me/feed
parameters:@{@"message": @"text message with location",@"link":@"www.google.com",@"place":@"Road No 19, Mumbai"}];
使用ACFacebookPermissionsKey:@ [@“publish_stream”, @ “publish_actions”], 返回500状态错误。
感谢。
答案 0 :(得分:0)
500内部服务器错误是“服务器端”错误,这意味着问题不在于您的PC或Internet连接,而是网站服务器的问题。
使用此功能集成您的代码以共享位置 https://developers.facebook.com/docs/ios/placepicker-ui-control/
使用此方法发布Feed: -
-(IBAction)postFBMessage:(id)sender
{
// Create the URL to the end point
NSURL *postURL = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"];
NSString *link = @"http://developer.apple.com/library/ios/#documentation/Social/Reference/Social_Framework/_index.html%23//apple_ref/doc/uid/TP40012233";
NSString *message = @"Testing Social Framework";
NSString *picture = @"http://www.stuarticus.com/wp-content/uploads/2012/08/SDKsmall.png";
NSString *name = @"Social Framework";
NSString *caption = @"Reference Documentation";
NSString *description = @"The Social framework lets you integrate your app with supported social networking services. On iOS and OS X, this framework provides a template for creating HTTP requests. On iOS only, the Social framework provides a generalized interface for posting requests on behalf of the user.";
NSDictionary *postDict = @{
@"link": link,
@"message" : message,
@"picture" : picture,
@"name" : name,
@"caption" : caption,
@"description" : description
};
SLRequest *postToMyWall = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:postURL parameters:postDict];
FacebookAccountManager* sharedManager = [FacebookAccountManager sharedAccount];
[postToMyWall setAccount:sharedManager.facebookAccount];
[postToMyWall performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
if (error) {
// If there is an error we populate the error string with error
_errorString = [NSString stringWithFormat:@"%@", [error localizedDescription]];
// We then perform the UI update on the main thread. All UI updates must be completed on the main thread.
[self performSelectorOnMainThread:@selector(updateErrorString) withObject:nil waitUntilDone:NO];
}
else
{
NSLog(@"Post successful");
NSString *dataString = [[NSString alloc] initWithData:responseData encoding:NSStringEncodingConversionAllowLossy];
NSLog(@"Response Data: %@", dataString);
}
}];
}