I am trying to submit what I think is a pretty basic open graph post on facebook in iOS7. I am using the latest version of everything, including facebook's SDK version 3.10.
My app brings up the share dialog preloaded with the parameters from my FBGraphObject. I even had an image URL in there earlier that shows in the preview, just took it out trying to troubleshoot. I type a few words in the "Say something about this..." part of the share dialog and tap "Post." This is the error I get:
Error Domain=com.facebook.Facebook.platform Code=102 "The operation couldn’t be completed. (com.facebook.Facebook.platform error 102.)" UserInfo=0x19192ba0 {error_message=An error occurred during publishing., app_id=299416296871047, error_code=102}
I can't seem to find another question with this same error. Here is my code:
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
NSMutableDictionary<FBGraphObject> *object =
[FBGraphObject openGraphObjectForPostWithType:#"og.item"
title:#"Test Post"
image:nil
url:#"https://mywebsiteurl.com"
description:#"A test post"];
[action setObject:object forKey:#"something"];
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:#"og.publish"
previewPropertyName:#"something"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
NSLog(#"Results: %#", results);
} else {
NSLog(#"Success.");
}//end if
}];
Any ideas?
I had the same problem. It turned out to be permission issue. Facebook user that that I used to post OG story wasn't administrator or the developer in the Facebook app roles and permissions.
In order to use it with any user your app has to be reviewed by Facebook.
I had the exact same problem. What's the size of the OG object in the URL?
Mine was rather large and the Facebook app was not waiting long enough to complete the post.
At the moment i'm publishing successfully via FBRequestConnection startForPostWithGraphPath
// create object
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:url forKey:#"something"];
[action setObject:#"true" forKey: #"fb:explicitly_shared"];
[FBRequestConnection startForPostWithGraphPath:#"me/og.item"
graphObject:action
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
}];
Make sure the 'Explicitly Shared' option for this action type is enables in the App Dashboard.
Related
I have integrated Facebook Sharing of a link with a description, caption, etc via the Native Facebook App (if it is installed) using the code:
FBLinkShareParams *params = [[FBLinkShareParams alloc] initWithLink:[NSURL URLWithString:#"https://abcde.com"]
name:#"demo"
caption:#"demo"
description:#"demo"
picture:nil];
//Present share dialog
[FBDialogs presentShareDialogWithParams:params clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
// Success
NSLog(#"result %#", results);
}
}];
When this method runs, and the native facebook app is installed, I get an option to share a post that has caption, link and description. When I click share and I go on FB to check it, it appears to only have the link?
Can someone suggest a possible fix?
Most likely it is due to newest Facebook sharing policy 2.3
I'm trying to create a share button which share a post on Facebook. I've found this code below under Dialogs and UI controls on the Facebook developer page. It works just fine. The only problem is that after a few seconds on the Facebook post page it automatically goes back to the app without me clicking on anything. The below code is everything related to Facebook I've added, beside the plist Facebook app info.
How come it automatically returns to the app?
Code :
id<FBGraphObject> mealObject =
[FBGraphObject openGraphObjectForPostWithType:#"cooking-app:meal"
title:#"Lamb Vindaloo"
image:#"https://example.com/cooking-app/images/Lamb-Vindaloo.png"
url:#"https://example.com/cooking-app/meal/Lamb-Vindaloo.html"
description:#"Spicy curry of lamb and potatoes"];
id<FBOpenGraphAction> cookAction = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[cookAction setObject:mealObject forKey:#"meal"];
[FBDialogs presentShareDialogWithOpenGraphAction:cookAction
actionType:#"cooking-app:cook"
previewPropertyName:#"meal"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
How to post a photo to friend's wall like when you post a photo using facebook site (using "Post" form at the top of friend's wall and switched to "Photo" tab). Result should be something like this:
I know how to post a simple post to friend's wall using [FBWebDialogs presentFeedDialogModallyWithSession..] and #"to" parameter. But is there any way to post exactly a photo (with big thumbnail)?
Removing the ability to post to friends' timelines via API
We have found that posting content via API (stream.publish) on a friend's wall lead to a high incidence of user dissatisfaction (hiding content, blocking the app). After the migration period, posting content to friends' timelines via stream.publish will no longer be allowed. Please use the Feed Dialog for posting
// only supports passing a single image
NSArray* images = #[
#{#"url": [UIImage imageNamed:#"my-awesome-meal-photo.jpg"], #"user_generated" : #"true" }
];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:#"https://example.com/cooking-app/meal/Lamb-Vindaloo.html" forKey:#"meal"];
[action setObject:images forKey:#"image"];
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:#"fbsdktoolkit:cook"
previewPropertyName:#"meal"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
I am working on a ios app.
I need to share a video link to facebook.Video will save on my server.
I am using below code:-
params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
AppName, #"title",
AppName, #"name",
[NSString stringWithFormat:#"%#",text], #"caption",
composeViewController1.text, #"description",
Path, #"link",
[NSString stringWithFormat:#"%#%#app_icon-DEMO.png",ServerPath,URLImageFolder], #"picture",
nil];
[FBRequestConnection startWithGraphPath:#"/me/feed"
parameters:params
HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Link posted successfully to Facebook
NSLog(#"result: %#", result);
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"%#", error.description);
}
}];
But i am getting below error from this
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xc52be90 {com.facebook.sdk:HTTPStatusCode=500, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 1500;
"error_subcode" = 1609005;
message = "This link could not be posted.";
type = FacebookApiException;
};
};
code = 500;
But if i try to share static link say "www.google.com" it is working.
My app's flow is :-
User will check mark on facebook button and the feed will share on facebook and my app at the same time.
Thanks for help.
I don't know exactly whats going wrong here, but as far I know Facebook return com.facebook.sdk code=5 the operation couldn't be completed. (com.facebook.sdk error 5.) this error in few cases, like
Session is is not open.
Facebook has detected that you're spamming the system.
Facebook has a defined limit using the SDK.
You don't have permission to do so or wrong publish permission.
The link you have provided is not working. When I tried to open the link it's say
Facebook need to parse your url. May be that's why fb not give you to post the url.
What i was trying to do was to publish a camera generated photo into facebook with an open graph action.
here is the code i used:
UIImage *imageToShare = [EXPOINNOVAImageCombiner mergeImages:photo TopImage:tbot];
//Custom UIImage to be shared on facebook
NSArray* images = #[#{#"url": imageToShare, #"user_generated" : #"true" }];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:#"http://emaginelab.com/FBAction/fbtbot.html" forKey:#"tbot"];
[action setObject:images forKey:#"image"];
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:#"expoinnovaapp:took_a_photo_with"
previewPropertyName:#"tbot"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"Error: %#", error.description);
} else {
NSLog(#"Success!");
}
}];
When i set the user_generated flag to false, the post works, but if its true facebook tries to post it, but falls back to the app before the upload finishes.
I already registered my app in facebook, and added the user generated photos capability so, in theory, the app should post a larger version of the photo in the user timeline.
btw the image is 640x640
what am i doing wrong here?
thanks in advance