How to retrieve iOS App info from another iOS App?

156 views Asked by At

so I'm trying to create plugin for Flutter, where I'll be able to use it in order to show information regarding device/app. I've managed to do it for android/java by including

if (call.method.equals("getPackageInfo")) {
  String packageName = call.argument("packageName"); --> being "com.example.appName"
  try {
    PackageInfo info = devMenu.getPackageManager().getPackageInfo(packageName, 0);
  }
}

Now I'm wondering if it is possible to do the same for iOS? Code from down under is retrieving information but not for the main package "com.example.appName" because I didn't find any option to pass that String and get correct data.

if ([call.method isEqualToString:@"getPackageInfo"]) {
  result(@{
    @"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
        ?: [NSNull null],
    @"packageName" : [[NSBundle mainBundle] bundleIdentifier] ?: [NSNull null],
    @"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
        ?: [NSNull null],
  });
}

Thanks in advance

0

There are 0 answers