46434

How to share location on Facebook along with message using https://graph.facebook.com/me/feed

Question:

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

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"}];

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

Thanks.

Answer1:

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.

<strong>Use this to integrate in your code to share location</strong> <a href="https://developers.facebook.com/docs/ios/placepicker-ui-control/" rel="nofollow">https://developers.facebook.com/docs/ios/placepicker-ui-control/</a>

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); } }]; }

Recommend

  • How to make a search on google maps for finding hospitals etc
  • How to change language of placepicker in android?
  • Debug assembly code using Kdbg
  • cf.net exception and other logging
  • Cannot deploy to with gh-pages with specific project due to error: cannot spawn sh: No such file or
  • Python Tkinter entry widget won´t accept input
  • getting the error “ERROR: EOF” when i execute a Heroku command “heroku login” in ubuntu?
  • php studio
  • Creating foreign key in MySQL
  • RAdwords error (“server certificate verification failed”)
  • Can I run mySQL when my computer is off?
  • My Produce Consumer Hangs
  • get logs of login and logout of windows users
  • How to make local USB port to work with Azure virtual machine
  • InputDispatcher Error
  • Background image does not show on iPhone/iPad
  • Google Places API - Get more than 10 photos from Details Response?
  • Android Oreo JobIntentService Keep running in background for Android 7 &below and crashing often
  • Connecting Google Cloud SQL with Wordpress on Google Compute Engine
  • How to make SASS put relative paths in its output
  • Error in installing package: fatal error: stdlib.h: no such file or directory
  • Is there a way to save the selected text and highlight it again once the page is refreshed?
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Zurb Foundation _global.scss meta styles for js?
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • Custom Tabgroup Appcelerator
  • Bug in WPF DataGrid
  • JavaScriptCore crash on iOS9
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • How would I use PHP exceptions to define a redirect?
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • QuartzCore.framework for Mono Develop
  • RestKit - RKRequestDelegate does not exist
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Memory offsets in inline assembly
  • Programmatically clearing map cache
  • Unable to use reactive element in my shiny app