objectivec: fb post comment error - iphone

I created an ios application and want to post a comment to an article and to the comment of this article. But I can't get it work.
Comment an article: I test with the graph "post_id/comments" using the post_id that I found on the page of "Object Debug".
I got error "500" when I posted by ios SDK and
{"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}}
when I posted by https://graph.facebook.com/{post_id}/comments
Post a sub comment to a comment: I used graph "commentID/comments", I got error 400 when I posted by ios sdk, and
{"error":{"message":"(#100) Invalid fbid.","type":"OAuthException","code":100}}
when I posted to https://graph.facebook.com/{commentID}/comments

I think what you are doing is correct but just you need to have problem is with Authentication.
Before comment or any post you must be logged or your session must be active. Check weather your session is active or not.
First of all call [myDelegate authenticateFacebookUser]; and then call method to post a comment.

Related

'An unknown error has occurred.' when updating a facebook group's cover_url

How do I successfully update a facebook group's cover_url through the graph api? No matter what I try, I get an error on the 3rd step from below:
Create a group by POST /APP-ID/groups DOCUMENTATION: https://developers.facebook.com/docs/graph-api/reference/v2.5/app/groups#publish
Get the returned GROUP-ID
Using the same access_token, POST /GROUP-ID with cover_url param DOCUMENTATION: https://developers.facebook.com/docs/graph-api/reference/v2.5/group/#update
The error I'm receiving is in the form:
{
message: 'An unknown error has occurred.',
type: 'OAuthException',
code: 1,
fbtrace_id: <SOME-ID>
}
I'm imagining there's some restriction on valid cover photos, but neither the documentation or the error give me any indication as to what that is.
I submitted a bug report to facebook in the case this is legitimately a facebook bug: https://developers.facebook.com/bugs/425584494232936/
Turns out, this is an issue with the facebook api itself.

AS3: Post to Facebook Wall - Error #2032

I am currently developing an app with which visitors of an event can take pictures using a webcam and upload them to Facebook using an AS3-application. I know I can connect to Facebook, because I can log the user out using the API and I can get all the information. The problem is that I can't post to their wall for some reason. I keep getting the following error:
error #2032: stream error. url: https://graph.facebook.com/********/feed
I use the following code to post to Facebook:
private function postFB(e:Event=null):void {
var _params:Object = new Object();
_params.uid = Facebook.getAuthResponse().uid;
_params.access_token = Facebook.getAuthResponse().accessToken;
_params.message = "I was at the Thanksgiving Day Event.";
//_params.picture = _bitmap;
Facebook.api("/me/feed", postComplete, _params, "POST");
}
As I've said before, I know I am connected to facebook because if I change "POST" to "GET" in my api-call, I get all the information of my account. I have the correct permissions as far as I know (read_stream, publish_stream, user_photos). I use GraphAPI_Web_1_8_1.swc as an api.
The documentation on the entire api is very poor, so I am trying to figure out the problem. It's been a few years since I've tried any of this, so my code has probably aged too far by now. So, any ideas what I'm doing wrong?
publish_stream is deprecated (since years?), you need to use publish_actions.
If that does not work, make sure the Access Token includes all the permissions, you can test this in the Debugger: https://developers.facebook.com/tools/debug/
Side note: AS3 is not getting used very often anymore, the last version of the the AS3 SDK is from 2011. It may be a good idea to switch to the JavaScript SDK.

"Unexpected error occurred" getting When open FBWebDialog in iOS

I am sharing job Details to Facebook Friends, using the "Message" Parameter to post all content.
When I open FBWebDialogbox FBWebDialogs presentRequestsDialogModallyWithSession:<#(FBSession *)#> message:<#(NSString *)#> title:<#(NSString *)#> parameters:<#(NSDictionary *)#>.
I get the following error "Unexpected Error Occurred. Please try again later". But when I post less content with with the message param the error did not occur.
I've already posted with more content using Graph API to My Wall. But now I want to change to post to friends, however that is not supported in the Graph API.
Can I get any tips or suggestions on for this? Thanks.

How to delete a photo posted by an App in Facebook

I have created an app to post a photo in Facebook. I want to delete those photos posted by my app. I have read the documentation and found that Facebook allows Apps to delete the photos posted by them. Click Here This link gives the answer for my question.
You can delete photos for a user posted from your app by issuing an HTTP DELETE request to PROFILE_ID/photos with the user access token or app access_token.
But how to issue a HTTP delete request. Don't we need the photo id for deleting the photo?
I have tried to send a HTTP DELETE REQUEST as mentioned above using PHP SDK. But I got an error like this
Fatal error: Uncaught GraphMethodException: Unsupported delete request.
This is how I send the request
$response = $facebook->api('/me/photos/','delete',array("photoid" => "$photoid"));
Please help
In order to delete a photo that was created by the application, you have to make a DELETE request to a url like this:
https://graph.facebook.com/PHOTO_ID
I'm not sure why the documentation states otherwise (might be worth a bug report).
So in the PHP SDK, it would look something like this:
$facebook->setAccessToken( YOUR_APP_TOKEN );
$response = $facebook->api( '/PHOTO_ID', 'delete' );

Posting on user's timeline on the behalf of the user

I created and APP on the Facebook.
Now I am trying to post a comment on the user's timeline using the Graph API but I cannot undestand what I need to do.
I already authorized the Application (I authorized this permissions: 'user_status,publish_stream,user_photos,email').
If I look on my profile -> privacy I can see that the APP can:
This app can: Post on your behalf
This app may post on your behalf, including status updates, photos and more.
Last data access:
Basic InformationToday
See details ยท Learn more
Posts on your behalf:
Who can see posts this app makes for you on your Facebook timeline?
Public
Notifications:
When to notify you?
The app sends you a notification
So this part seems OK.
On my application I do the following to try to post somenthing on my timeline (I need to post it when I am off line).
1) GET : https://graph.facebook.com/oauth/access_token?client_id=APPID&client_secret=*APP_SECRET*&grant_type=client_credentials
RESPONSE:
access_token = 422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk
2) GET: https://graph.facebook.com/search?q=myemail&type=user
RESPONSE:
_"error":_{
______"message":_"A_user_access_token_is_required_to_request_this_resource_",
______"type":_"OAuthException",
______"code":_102
___}
But reading the documentation (https://developers.facebook.com/docs/reference/api/#searching) it seems that this request does not need any kind of access token.
I also tried to add the access token, but the result is still the same.
3) I know my facebookid so I tried to use it directly:
POST: https://graph.facebook.com/100001139132403/feed
ARGUMENT:
access_token=422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk,
message=Hello
RESPONSE:
"error": {
"message": "(#200) This API call requires a valid app_id.",
"type": "OAuthException",
"code": 200
}
}
So I tried to add client_id=APPID and app_id=APPID, I tried to put one, the other and also both arguments as GET or POST but nothing changed.
I checked the APPId ad it is correct.
Do someone have any idea?
Thank you!
You cant simply generate a user access_token by querying to a URL. What you did gives the App access token and as the error say, you are trying to do something, that needs user access_token.
Refer and implement this : https://developers.facebook.com/docs/howtos/login/server-side-login/
And use that access_token for the rest of the processes.