在iOS设备上安装以编程方式下载的ipa

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

问题类似于从iOS下载并安装ipa ,但区别在于ipa已经在我的情况下下载了。

我尝试了以上问题的解决scheme的以下变化:

  • 修改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

这是参考Facebook如何分发其内部应用程序的dogfooding 。 想要做类似的事情,以便在下载应用程序后提示用户安装应用程序,从而提高安装的周转率。

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

您可以尝试validation您的应用程序的一件事是,打开Xcode-Window-Devices,select连接到您的MacBook的iPhone设备,并将刚刚存档的ipa拖动到应用程序区域,以查看是否可以安装。 如果可以,请检查您的URL的包标识符是否与您的应用程序相同。 你应该很好走。

我们做类似的事情像你的。 我们还通过内部分发来分发我们的应用程序。

我们将检查是否有版本,我们将popup一个UIAlertView并要求用户更新。 用户可以点击确定button,它会自动开始下载和安装。

确定button的代码是这样的:

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

Interesting Posts