【发布时间】:2020-07-08 09:18:21
【问题描述】:
我使用了 Url_launcher 包;如果应用程序安装在浏览器中,我想在 Facebook 应用程序中打开 Facebook 链接。这在 Android 中很好用,但在 IOS 中它只打开 Facebook 应用程序而不是链接。
代码是:
String digital_url= "https://facebook.com/AliForDigitalIsrael/";
new ListTile(
leading: new SvgPicture.asset(
'assets/images/ic_menu_fb.svg',
height: 24.0,
width: 24.0,
color: Colors.black54,
),
title: new Text(
Strings.fbdigital,
textDirection: TextDirection.rtl,
),
onTap: () async {
var fbUrl =
"fb://facewebmodal/f?href=" + Strings.digital_url;
launchFacebook(fbUrl, Strings.digital_url);
hideDrawer();
},
),
Future<void> launchFacebook(String fbUrl,String fbWebUrl)
async {
try {
bool launched = await launch(fbUrl, forceSafariVC: false);
print("Launched Native app $launched");
if (!launched) {
await launch(fbWebUrl, forceSafariVC: false);
print("Launched browser $launched");
}
} catch (e) {
await launch(fbWebUrl, forceSafariVC: false);
print("Inside catch");
}
}
【问题讨论】:
-
您是否为 iOS 编辑了 info.plist 文件?您必须为 iOS 设置 URL 方案才能使深层链接正常工作。
-
@danypata 不,我没有这样做,你能分享给我任何重新评分的链接吗?
-
@danypata 我不明白。您能否提供其他链接或解决方案。
标签: flutter dart flutter-test flutter-packages flutter-ios