我正在尝试通过 AppLinks url 打开 facebook 应用程序,它会打开用户个人资料/页面,但不显示“返回引用应用程序”按钮,我正在提供“referer_app_link”数据,我已通过此参考http://applinks 生成 JSON。 org/documentation/#applinknavigationprotocol
NSDictionary *dict = @{
@"target_url" : @"fb://profile/USER_ID",
@"referer_app_link" : @{
@"target_url" : @"MY WEBSITE",
@"url" : @"CALLBACK URL",
@"app_name" : @"MY APP NAME",
@"app_store_id" : @"MY APP STORE ID"
}
};
NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
jsonString = [jsonString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *stringUrl = [NSString stringWithFormat:@"fb://applinks?al_applink_data=%@",jsonString];
NSLog(@"String url is %@",stringUrl);
NSURL *url = [NSURL URLWithString:stringUrl];
if([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
} else {
NSLog(@"Cant open %@",url);
}
有任何想法吗 ?Facebook应该有“后退按钮”吗?我的 url 方案设置正确...
更新: NSDictionary 包含所有有效值,我现在不想发布它们,但是 url 、 name 、 store id ...等都是有效的
更新 #2: 从 iOS 9 开始,这是由 iOS 系统自动完成的。