pichillilorenzo / flutter_appavailability

A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.
https://pub.dartlang.org/packages/flutter_appavailability
MIT License
92 stars 89 forks source link

App not found IOS #7

Open lauralarez opened 5 years ago

lauralarez commented 5 years ago

I am launching a flutter app (App 1) from another flutter app (App 2) on Android and it works perfectly. However, I keep getting the same error on IOS. It does not recognize the package name.

I have tried with multiple apps but is the same result, it currently just recognizes the calendar package.

pubspec.yaml file flutter_appavailability

main.dart App 2

import 'package:flutter_appavailability/flutter_appavailability.dart';

//Future void method
if (Platform.isIOS) {

_installedApps = [
        {"app_name": "example", "package_name": "com.flutter.example"},
      ];

      print(await AppAvailability.checkAvailability("com.flutter.example")); //ERROR

 //Widget build
return Container {
 child : Row(
   ...
   GestureDetector(
    ...
    onTap: () {
              Scaffold.of(context).hideCurrentSnackBar();
              AppAvailability.launchApp(installedApps[0].["package_name"])
                  .then((_) {
                print("App ${installedApps[0]["app_name"]} launched!");
              }).catchError((err) {
                Scaffold.of(context).showSnackBar(SnackBar(
                    content: Text(
                        "App ${installedApps[0]["app_name"]} not found!")));
                print(err);
      });
...
 ),
}

info.plist App 1

<key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

project.pbxproj App 1 PRODUCT_BUNDLE_IDENTIFIER = com.flutter.example;

Output App 2

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: PlatformException(, App not found com.flutter.example, null)
#0      AppAvailability.checkAvailability (package:flutter_appavailability/flutter_appavailability.dart:40:9)
johngorithm commented 4 years ago

Hi @lauralarez

Try including the following in your Info.plist

<key>LSApplicationQueriesSchemes</key> 
<array> 
   <string> package_name </string> 
</array>
shinewanna commented 4 years ago

Hi @lauralarez

Try including the following in your Info.plist

<key>LSApplicationQueriesSchemes</key> 
<array> 
   <string> package_name </string> 
</array>

Not work yet