当我点击从我的应用程序发布的帖子时,我正在尝试从 Facebook 打开我的应用程序。
我在developers.facebook 注册了我的应用程序。
我在我的 Facebook 应用设置中启用了深度链接。
我已经为应用程序创建了 URL 方案。
注意:我的应用没有发布到应用商店。(苹果应用商店和 Facebook 应用中心)
我尝试了以下方法:但是,该帖子已成功发布,但当我点击该帖子时,Facebook 并未打开我的应用程序。
单程:
// Create an object
NSDictionary *properties = @{
@"og:type": @"books.book",
@"og:title": @"A Game of Thrones",
@"og:description": @"In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.",
@"books:isbn": @"0-553-57340-3",
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create an action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = @"books.reads";
[action setObject:object forKey:@"books:book"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"books:book";
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
dialog.mode = FBSDKShareDialogModeNative;
}
else {
dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
}
dialog.shareContent = content;
dialog.delegate = self;
dialog.fromViewController = self;
[dialog show];
另一种方式:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"https://developers.facebook.com"];
content.contentTitle=@"TestSHare";
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
dialog.mode = FBSDKShareDialogModeNative;
}
else {
dialog.mode = FBSDKShareDialogModeBrowser; //or FBSDKShareDialogModeAutomatic
}
dialog.shareContent = content;
dialog.delegate = self;
dialog.fromViewController = self;
[dialog show];
Facebook 正在打开应用中心页面。但不是我的应用程序。
深度链接是否仅在应用发布时才有效?
有什么原因吗?