get list of installed applications on iphone objective-c

前端 未结 6 1238
灰色年华
灰色年华 2020-12-05 12:26

I have an application that needs to get the list of installed (other, maybe third party) applications on the device. How can it be done? Or can it be done at all?

6条回答
  •  忘掉有多难
    2020-12-05 13:11

    So magicd's answer and Victor's comment with the link to the header file helped me solve this.

    I did want to add that you have to add the MobileInstallation.framework to the "Linked Frameworks and Libraries" in Xcode. I found that framework here:

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/PrivateFrameworks

    I can confirm that this does work on a non-jailbroken device. The app store is not a concern for me.

    Here's the code I used:

    NSDictionary *options = [NSDictionary dictionaryWithObject:@"Any" forKey:@"ApplicationType"];
    NSDictionary *apps = (__bridge NSDictionary *) MobileInstallationLookup((__bridge CFDictionaryRef) options);
    

提交回复
热议问题