简体   繁体   中英

Open native iOS app from Facebook feed

I'm sharing a FBSDKShareOpenGraphObject with an FBSDKShareOpenGraphAction of type "video.watches" using the Facebook's SDK. Everything goes fine, the post appears on the Facebook feed but if I tap on the application's name I get an error. This is the code I'm using for sharing:

FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:@{@"og:type": @"video.other",
                                                                                              @"og:title": @"TV Show",
                                                                                              @"og:image": @"http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2013/02/tv-set.jpg",
                                                                                              @"og:url": show_url}];

FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
[action setActionType:@"video.watches"];
[action setObject:object forKey:@"video"];
[action setNumber:@(7200000) forKey:@"expires_in"];

FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
[content setPreviewPropertyName:@"video"];
[content setAction:action];

_shareDialog = [[FBSDKShareDialog alloc] init];
_shareDialog.fromViewController = [self.delegate collectionViewControllerForCell:self];
_shareDialog.shareContent = content;
_shareDialog.delegate = self;
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
    _shareDialog.mode = FBSDKShareDialogModeNative;
} else {
    _shareDialog.mode = FBSDKShareDialogModeAutomatic;
}
[_shareDialog show];

The result:

分享结果

But when I tap on TV Channel (the boxed one) I get this error:

在此处输入图片说明

I'd like to open the native application when I tap on that text, in the same way Instagram opens when you tap on it's name in the "X posted a photo on Instagram" on a photo. I configured the Bundle ID and the iPhone Store ID in application's settings, on developer.facebook.com, but no success. What I am missing?

Go to developers.facebook.com and make sure your app is not in test mode. Go to "App Review" -> Make public? And mark it as yes.

If you are not ready to make it public, add the facebook user you are using to the testers of the app under "Roles".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM