How to delete an iOS app programatically using pri

2019-04-02 23:04发布

I am making an in-house (Enterprise) app. I want to delete other installed apps from the iOS device programmatically. I have successfully retrieved the installed apps' info (e.g. name, bundleId, version, icon etc.) using Apple's private framework methods. Please tell me how can I do that (i.e. delete an app). Thanks.

3条回答
家丑人穷心不美
2楼-- · 2019-04-02 23:32

This is not possible with a non Jailbroken device, even with private APIs.

查看更多
放我归山
3楼-- · 2019-04-02 23:38

You will need an MDM solution, which gives the company quite a lot of power over enrolled devices. Using iOS software, there is no way whatsoever. And I'll just assume that your enterprise won't let jailbroken phones anywhere near it!

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-04-02 23:41

Here is a solution (No jailbreak No crash) but its not working every time. Sometime it failed to uninstall application and return NO.

NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileCoreServices.framework"];
BOOL success = [b load];
if(success)
{
    Class LSApplicationWorkspace = NSClassFromString(@"LSApplicationWorkspace");
    id si = [LSApplicationWorkspace valueForKey:@"defaultWorkspace"];

    SEL selector=NSSelectorFromString(@"uninstallApplication:withOptions:");
    BOOL what=[si performSelector:selector withObject:@"Bundle_ID" withObject:nil];
}
查看更多
登录 后发表回答