4

I'm trying to detect built-in iOS apps (Calendar, Reminders, Weather) exist or not.

I've tried using canOpenURL:.

- (BOOL) isCalendarExist {
  UIApplication *app = [UIApplication sharedApplication];  
  NSURL *calUrl= [NSURL URLWithString: @"calshow://"];
  return [app canOpenURL: calUrl];
}

But canOpenURL: always return TRUE value even if Calendar is deleted.

Is there anyway to check if a built-in app exists or not?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Thang
  • 49
  • 3
  • 1
    There is a way to check installed apps on ios, https://stackoverflow.com/a/44986545/501439 – GeneCode Jul 14 '17 at 03:09
  • 1
    This way is inefficient – Kingsley Mitchell Jul 14 '17 at 03:21
  • @GeneCode: Thanks for your response. I've tried this way, but it always returns 0 element for app list. I'm using xcode 8 with iOS 10. I thought It may worked with earlier sdk. – Thang Jul 14 '17 at 03:31
  • 2
    You'll want to consider the whole story, which is better [explained here](https://stackoverflow.com/a/40415485/5099014). Beware of private APIs. Having spoken directly with Apple engineers, Apple **really** doesn't want developers knowing what apps are installed. Even using canOpenURL can get you [rejected](https://stackoverflow.com/q/30298568/5099014) – allenh Jul 14 '17 at 03:34
  • 1
    *canOpenURL* can be used anyways without any rejection issues to open apps from your app.As per apple docs, The return value does not indicate the validity of the URL or whether the specified resource exists.By returning true, *openURL(_:) * method checks if your app is registered with device to open app with specified url scheme in info.plist. – Ellen Jul 14 '17 at 06:57

0 Answers0