Search code examples
iosflutterurl-launcher

iOS App Store link don't work in Flutter url_launcher


I am using url_launcher in my flutter app to open an app in iOS App Store, in ios device Url: https://apps.apple.com/se/app/instagram/id389801252

I enabled mode: LaunchMode.externalNonBrowserApplication to launch the app directly in App Store, it worked before but not now. launchUrl return false. and same function works well in Android devices but not in iOS

 if (await canLaunchUrl(Uri.parse(url))) {
      if(externalNonBrowserApplication == true){ 
        await launchUrl(Uri.parse(url), mode: LaunchMode.externalNonBrowserApplication);
      }
      else {
        await launchUrl(Uri.parse(url)); 
      }
    } else {
      print('Could not launch $url');
    }

Flutter version: 3.3.4 url_launcher: 6.1.6 ios: 16


Solution

  • I solved the issue in iOS devices by adding externalApplication and externalNonBrowserApplication for Android devices

    await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);