How can I check programmatically that list of applications are installed or not in iPhone

前端 未结 2 824
-上瘾入骨i
-上瘾入骨i 2021-01-29 13:36

In my app I\'m showing list of applications.Is it possible to find that the array of applications are installed or not in iPhone. If any possibility is there anyone please provi

相关标签:
2条回答
  • 2021-01-29 13:53

    In the old times you could have used canOpenURL with a library like iHasApp. This only works for apps that register custom deep link schemes, but it was capturing the majority of important apps.

    But since iOS 9 there seems to be a limitation to this approach - see How to reset `canOpenURL` limit in iOS9?

    In general your app is not allowed to know what else is installed in the system for privacy reasons.

    0 讨论(0)
  • From your sandboxed application

    By default from an Application Layer, you are not allowed to use the private API's to check what other applications are installed on your device.

    Workarounds

    1. If the target third-party app supports URL schemes. You can check the url scheme they implement using [UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"someScheme://randomText"]] .

    2. (Not recommended)Take a look at private frameworks like /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices LSApplicationWorkspace . There is a method called allInstalledApplications in LSApplicationWorkspace which should work, check runtime headers for more info.

    Off topic ~ For MDM devices

    Using Mobile Device Management (MDM) protocol, you can use InstalledApplicationList command to get the array of installed applications on the target device. The following is the response for the said MDM command.

    0 讨论(0)
提交回复
热议问题