在iOS设备上安装以编程方式下载的ipa [英] Install a programmatically downloaded ipa on an iOS device

查看:81
本文介绍了在iOS设备上安装以编程方式下载的ipa的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以编程方式下载一个ipa文件(我的应用程序的企业版),并提示用户安装它.

I am programmatically downloading an ipa file (enterprise version of my app) and prompting the user to install it.

问题类似于从以下位置下载并安装ipa iOS上的网址,但是区别是我的情况下已经下载了ipa.

The problem is similar to Download and install an ipa from url on iOS, but the difference is that the ipa is already downloaded in my case.

我为上述问题的解决方案尝试了以下变体:

I tried the following variation for the above problem's solution:

  • 修改plist,使其包含指向本地下载的ipa的URL.

```

<?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>items</key>
    <array>
        <dict>
            <key>assets</key>
            <array>
                <dict>
                    <key>kind</key>
                    <string>software-package</string>
                    <key>url</key>
                    <string>file://{path-to-local-ipa}</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.yourCompany.productName</string>
                <key>bundle-version</key>
                <string>1</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>productName</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

```

  • 更新itms链接以指向本地更新的plist文件-itms-services://?action=download-manifest&url=file://{path-to-local-plist}

但是,当使用[[UIApplication sharedApplication] openURL:itmsLink]打开itms链接时,它不起作用,并给我一个错误,提示 Cannot install applications because the certificate for (null) is not valid

But, when opening the itms link using [[UIApplication sharedApplication] openURL:itmsLink] it doesn't work and gives me an error saying Cannot install applications because the certificate for (null) is not valid

这与Facebook如何分发其内部应用程序有关

This is with reference to how Facebook distributes its internal app for dogfooding. Want to do something similar so that the user is prompted to install the app after the app is downloaded, thus increasing the turnaround rate for its installation.

推荐答案

您应首先检查证书和捆绑软件ID.错误消息提供了足够的信息,您看到有一个"null",这意味着您的应用程序没有捆绑软件ID?检查应用程序的捆绑软件ID,证书设置,配置文件设置,以确保它们相互匹配.

You should check your certificates and bundle ID first. The error message gives enough info, you see there is a 'null' which means your app does not have a bundle id? Check your app's bundle ID, certificate settings, provisioning file settings, to make sure they are matched with each other.

您可以尝试验证您的应用程序的一件事是,打开Xcode-Window-Devices,选择连接到Macbook的iPhone设备,然后将刚刚存档的ipa拖动到应用程序区域,以查看是否可以已安装.如果可以,请检查您的URL的捆绑包标识符是否与您的应用程序相同.你应该很好走.

One thing you could try to validate your app is, open Xcode-Window-Devices, choose your iPhone device which is connected to your macbook, and drag the ipa you just archived into the apps area, to see if it can be installed. If it can be, check your URL's bundle identifier to be the same one as your app. You should be good to go.

我们做类似您的事情.我们还通过内部分发来分发我们的应用.

We do similar things like yours. We also distribute our app via in-house distribution.

我们将检查是否存在版本,我们将弹出UIAlertView并要求用户进行更新.用户可以单击确定"按钮,它将自动开始下载和安装.

We will check if there is a version, we will pop up a UIAlertView and ask user to update. User can click OK button, and it will start downloading and installing automatically.

确定"按钮的代码如下:

The OK Button's code is like this:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (alertView == updateAlert){
        if (buttonIndex == 1 || _forceUpdate) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:Download_URL]];
        }
    }
}

根据您的情况,Download_URL可以为itms-services://?action=download-manifest&url=file://{path-to-local-plist}.

Where Download_URL can be itms-services://?action=download-manifest&url=file://{path-to-local-plist} in your case.

这篇关于在iOS设备上安装以编程方式下载的ipa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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