溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

iOS6 代碼實(shí)現(xiàn)安裝ipa

發(fā)布時(shí)間:2020-07-28 02:39:04 來源:網(wǎng)絡(luò) 閱讀:2820 作者:chenjohney 欄目:移動(dòng)開發(fā)

在使用91助手的時(shí)候,下載應(yīng)用的時(shí)候并沒有彈出是否安裝應(yīng)用,所以91助手的實(shí)現(xiàn)有可能是通過代碼來安裝應(yīng)用的,經(jīng)過這兩天的摸索(貌似效率有些低啊),最后實(shí)現(xiàn)了,整理了些資料,分享一下,如果有補(bǔ)充的,歡迎評論.

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

一、破解Xcode,將項(xiàng)目生成無簽名的app文件,這步很重要,若xcode不破解,使用ldid對權(quán)限進(jìn)行修改時(shí)將卡住并失敗。

Xcode破解鏈接:

<最簡單破解Xcode,切換破解狀態(tài)> http://chenjohney.blog.51cto.com/blog/4132124/1256600


二、使用private API,加載MobileInstallation 庫,調(diào)用安裝方法

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


三、將項(xiàng)目真機(jī)調(diào)試生成app, 使用ldid 修改app權(quán)限,ldid在文章中的附件中可以下載

新建一個(gè)配置文件entitlements.xml,粘貼以下內(nèi)容

<?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

查看結(jié)果:

ldid -e InstallApp.app/InstallApp

四、將app打包成ipa

新建一個(gè)文件夾,命名為“Payload”。將剛剛添加好權(quán)限的APP文件放到這個(gè)文件夾中。右鍵“壓縮Payload”,得到一個(gè)“.zip”文件,將這個(gè)ZIP文件的后綴名改為“.ipa”。


附件:http://down.51cto.com/data/2363204
向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI