颤振url_启动器不适用于IOS(在真实设备上测试)
以下是我的代码,它在Android上运行良好,并在浏览器上打开URl:颤振url_启动器不适用于IOS(在真实设备上测试),ios,flutter,Ios,Flutter,以下是我的代码,它在Android上运行良好,并在浏览器上打开URl: _launchURL(url) async { if (await canLaunch(url)) { await launch(url); } else { throw 'Could not launch $url'; } } 但对于IOS,我会遇到以下错误: 2020-10-22 10:23:23.896883+0300 Runner[805:312838] -c
_launchURL(url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
但对于IOS,我会遇到以下错误:
2020-10-22 10:23:23.896883+0300 Runner[805:312838] -canOpenURL: failed for URL: "(null)" - error: "Invalid input URL"
2020-10-22 10:23:23.899096+0300 Runner[805:313046] [VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: Could not launch https://manager.alkadhum-col.edu.iq/storage/test.pdf
我不明白为什么在URL:“(null)”中显示失败
而打印的URL显然不是null,程序没有传递canLaunch()
函数
我还尝试了直接使用launch(url)
而不使用canLaunch(url)
,但出现了以下错误:
'NSInvalidArgumentException', reason: 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported.'