如何使用非越狱设备的私有框架以编程方式删除iOS应用程序 [英] How to delete an iOS app programatically using private framework for non-jailbroken device

查看:260
本文介绍了如何使用非越狱设备的私有框架以编程方式删除iOS应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个内部(企业)应用程序。我想以编程方式从iOS设备中删除其他已安装的应用。我已经使用Apple的私有框架方法成功检索了已安装的应用程序的信息(例如name,bundleId,version,icon等)。请告诉我该怎么做(即删除一个应用程序)。谢谢。

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.

推荐答案

好吧@Salman表示

Well as @Salman indicated

这是一个解决方案(没有越狱没有崩溃),但它每次都不起作用。有时无法卸载应用程序并返回

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];
}

这篇关于如何使用非越狱设备的私有框架以编程方式删除iOS应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆