iOS6 代码实现安装ipa

发布时间:2020-07-28 02:39:04 作者:chenjohney
来源:网络 阅读:2807

在使用91助手的时候,下载应用的时候并没有弹出是否安装应用,所以91助手的实现有可能是通过代码来安装应用的,经过这两天的摸索(貌似效率有些低啊),最后实现了,整理了些资料,分享一下,如果有补充的,欢迎评论.

:需要在xcode中先把Command Line Tools装好。

一、破解Xcode,将项目生成无签名的app文件,这步很重要,若xcode不破解,使用ldid对权限进行修改时将卡住并失败。

Xcode破解链接:

<最简单破解Xcode,切换破解状态> http://chenjohney.blog.51cto.com/blog/4132124/1256600


二、使用private API,加载MobileInstallation 库,调用安装方法

h文件

#import "dlfcn.h"
typedefint (*MobileInstallationInstall)(NSString *path, NSDictionary *dict, void *na, NSString *path3_equal_path_maybe_no_use);

m文件

- (int)IPAInstall:(NSString *)path
{
    void *lib = dlopen("/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation", RTLD_LAZY);
    if (lib)
    {
        MobileInstallationInstall pMobileInstallationInstall = (MobileInstallationInstall)dlsym(lib, "MobileInstallationInstall");
        if (pMobileInstallationInstall){
            int ret = pMobileInstallationInstall(path, [NSDictionarydictionaryWithObject:@"User"forKey:@"ApplicationType"], nil, path);
            dlclose(lib);
            return ret;
        }
    }
    return -1;
}


三、将项目真机调试生成app, 使用ldid 修改app权限,ldid在文章中的附件中可以下载

新建一个配置文件entitlements.xml,粘贴以下内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>com.apple.private.mobileinstall.allowedSPI</key>
        <array>
            <string>Install</string>
            <string>Browse</string>
            <string>Uninstall</string>
            <string>Archive</string>
            <string>RemoveArchive</string>
        </array>
    </dict>
</plist>

在终端中输出命令:

ldid -Sentitlements.xml InstallApp.app/InstallApp

查看结果:

ldid -e InstallApp.app/InstallApp

四、将app打包成ipa

新建一个文件夹,命名为“Payload”将刚刚添加好权限的APP文件放到这个文件夹中右键“压缩Payload”,得到一个“.zip”文件,将这个ZIP文件的后缀名改为“.ipa”


附件:http://down.51cto.com/data/2363204
推荐阅读:
  1. 配置及使用iOS超级签名系统探讨
  2. iOS自动化打包

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

静默安装ipa ios代码安装软件 代码实现安装ipa

上一篇:如何利用VMware虚拟机安装Ubuntu

下一篇:ios开发中各种版本、设备的区分的代码

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》