我已经创建了一个包含 HTML 内容的网页,如 AppLinks 演示中所述,该链接是:http ://reittv.w3studioz.com/terms/terms1
我已在 facebook 应用程序设置中启用深度链接。现在我正在使用以下代码在 facebook 上分享帖子:
{
[FBSession openActiveSessionWithPublishPermissions: [NSArray arrayWithObjects: @"publish_stream", nil] defaultAudience: FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler: ^(FBSession *session,FBSessionState status,NSError *error)
{
NSLog(@"---------------");
if (error)
{
return;
}
else
{
[FBSession setActiveSession:session];
NSLog(@"LOGIN SUCCESS");
// Put together the dialog parameters
NSArray* actionLinks = [NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"Scisser",@"name",
@"http://reittv.w3studioz.com/terms/terms1",@"link",
nil],
nil];
NSData *jsonData2 = [NSJSONSerialization dataWithJSONObject:actionLinks options:NSJSONWritingPrettyPrinted error:&error];
NSString *actionLinksStr = [[NSString alloc] initWithData:jsonData2 encoding:NSUTF8StringEncoding];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"test", @"name",
@"testCaption", @"caption",
@"testDescription", @"description",
@"http://reittv.w3studioz.com/terms/terms1", @"link",
@"", @"picture",
@"foo", @"ref",
actionLinksStr, @"actions",
nil];
// Make the request
[FBRequestConnection startWithGraphPath:@"/me/feed"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error)
{
// Link posted successfully to Facebook
NSLog(@"Post was successfully shared on your Facebook timeline.");
NSLog(@"%@",[NSString stringWithFormat:@"result: %@", result]);
return;
}
else
{
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"%@",[NSString stringWithFormat:@"%@", error.description]);
return;
}
}];
}
}];
}
现在,当我单击帖子时,它会在 facebook 应用程序中打开 url(而它应该打开我的本机应用程序)并且没有检测到元标记(在 html 页面的头文件中)?我们怎样才能让我们的 appName 来打开应用程序呢?从几天开始,我现在真的很沮丧。请帮助解决这个问题。