Flutter url_launcher NOT working for IOS (test on real device)

Viewed 559

here is my code which works fine on Android and opens URl on a browser:

  _launchURL(url) async {
    if (await canLaunch(url)) {
      await launch(url);
    } else {
      throw 'Could not launch $url';
    }
  }

but for IOS I get this error:

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

I do not understand why is says failed for URL: "(null)" whereas the URL as printed is clearly not null, the program is not passing canLaunch() function.

I also tried launch(url) directly without canLaunch(url) and I got this error :

'NSInvalidArgumentException', reason: 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported.'
0 Answers
Related