2015-12-29 114 views
0

我以編程方式下載一個ipa文件(我的應用程序的企業版)並提示用戶安裝它。在iOS設備上安裝以編程方式下載的ipa

該問題類似於Download and install an ipa from url on iOS,但不同之處在於ipa已經在我的情況下下載了。

我嘗試了以下變化爲上述問題的解決方案:

  • 修改的plist包含URL到本地下載的ipa。

```

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

但是,打開ITMS時鏈接使用[[UIApplication sharedApplication] openURL:itmsLink]它不起作用,並給我一個錯誤說Cannot install applications because the certificate for (null) is not valid

這是參考Facebook如何分配其內部應用程序dogfooding。想要做類似的事情,以便在下載應用程序後提示用戶安裝應用程序,從而提高安裝的週轉率。

+0

爲什麼不把你的二進制文件上傳到App Store並讓它處理應用程序分發? – DDPWNAGE

+0

這是關於dogfooding內部版本的應用程序 - [臉譜 - 狗食](https://www.youtube.com/watch?v=Nffzkkdq7GM&feature=youtu.be&t=39m25s)。 App的分發版本已經在AppStore上。 – raviagarwal7

回答

0

您應該首先檢查您的證書和捆綁ID。錯誤消息提供了足夠的信息,您看到有'null'這意味着您的應用程序沒有包ID?檢查您的應用程序的包ID,證書設置,配置文件設置,以確保它們相互匹配。

您可以嘗試驗證您的應用程序的一件事是,打開Xcode-Window-Devices,選擇連接到您的MacBook的iPhone設備,然後將剛剛存檔的ipa拖動到應用程序區域,查看它是否可以被安裝。如果可能,請檢查您的URL的捆綁包標識符與您的應用程序相同。你應該很好走。

我們做類似的事情像你的。我們還通過內部分發來分發我們的應用程序。

我們將檢查是否有版本,我們將彈出一個UIAlertView並要求用戶更新。用戶可以點擊確定按鈕,它會自動開始下載和安裝。

OK按鈕的代碼是這樣的:

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

相關問題