I am trying to publish an open graph story containing an App Link.
I set up my story with the following code-
NSDictionary *properties = @{
@"og:type": @"bcskitracker:tour",
@"og:title": tour.route.name,
@"og:distance": [tour.distance stringValue],
@"og:vertical": [tour.ascent stringValue],
@"og:description": @"description",
@"og:url": @"https://fb.me/786890254772699",
@"og:image": photo
};
FBSDKShareOpenGraphObject *tourObject = [FBSDKShareOpenGraphObject objectWithProperties:properties];
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"bcskitracker:ski";
[action setObject:tourObject forKey:@"bcskitracker:tour"];
[action setString:@"true" forKey:@"fb:explicitly_shared"];
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"bcskitracker:tour";
[FBSDKShareAPI shareWithContent:content delegate:self];
If the photo is marked as userGenerated:NO, the story is published as expected with a caption and if you tap the post it opens the iPhone app:
However only one photo can be displayed and appears very small on the iPhone. If I mark the photo as userGenerated:YES the post displays the large photo, however there is no caption and no app link (only a link to facebook's app directory)-
The post doesn't even display the tour title as constructed in the story template-
Is there any way to include the caption and app link with a user generated photo? I understand I can set the action.message but this is restricted and doesn't link to the app.
This is currently intended behaviour; if you set a photo attachment as user_generated = yes
, it's considered as a photo upload. In that case, you can't mix in Open Graph information. So it's one of the two :)
What you could do, is to generate a single image on your server side with both the map and uploaded photo. If you use that as your og:image
, it will be included in the post.