如何在Facebook上分享位置以及使用https://graph.facebook.com/me/feed的消息 [英] How to share location on Facebook along with message using https://graph.facebook.com/me/feed

查看:316
本文介绍了如何在Facebook上分享位置以及使用https://graph.facebook.com/me/feed的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用iOS SLRequest和图形API https://graph.facebook.com/me / feed ,..在Facebook墙上发布位置的消息

Is it possible to use iOS SLRequest and graph API "https://graph.facebook.com/me/feed" ,..for posting a message with the location on Facebook wall ?

我已经实现了SLRequest如下,

I have implemented SLRequest as below,

                        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状态错误。

with ACFacebookPermissionsKey: @[@"publish_stream", @"publish_actions"], returns 500 status error.

谢谢。

推荐答案

500内部服务器错误是服务器端错误,这意味着问题不在您的PC或Internet连接,而是网站的服务器的问题。

The 500 Internal Server Error is a "server-side" error, meaning the problem is not with your PC or Internet connection but instead is a problem with the web site's server.

使用此功能将您的代码集成到共享位置
https://developers.facebook.com/docs/ios/placepicker-ui-control/

使用此方法发布Feed: -

Use this method to post 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);
        }
     }];
}

这篇关于如何在Facebook上分享位置以及使用https://graph.facebook.com/me/feed的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆