当我点击我的应用程序发布的帖子时,我正试图从Facebook打开我的应用程序。
我在developers.facebook中注册了我的应用程序。
我在Facebook应用设置中启用了深层链接。
我已经为该应用创建了URL方案。
注意:我的应用未发布到应用商店中。 (Appple Appstore和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正在打开应用中心页面。但不是我的应用程序。
深层链接是否仅在app发布时才有效?
有什么理由吗?