Download inhouse app from another app programmatically

空扰寡人 提交于 2019-12-08 06:52:52

问题


we have a lot of inhouse apps and want an app like AppStore. We did a demo. We can open installed apps but apps,not installed on iPhone, can't be downloaded from our servers to the iPhone.

We do:

if([UIApplication sharedApplication] canOpenURL:..] == false){
    NSString *schemelink = [NSString stringWithFormat:@"itms-services://?action=download-manifest&url=%@",**plist_url**];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:schemelink]]
}

The things that we do to find the reason:

  1. Copy-paste plist url to the Mac Safari and I check the plist and it's correct everything(ipa links and others). They all at the same path.
  2. Copy-paste just ipa url. It started to download on Mac.
  3. Copy-paste ipa url with itms-services://?action=download-manifest&url=, it says

There is no application set to open the URL ......ipa Search the App Store for an application that can open this document, or choose an existing application on your computer.

How can I solve it?

.plist:

<?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>https://....../AppName.ipa</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.company.AppName</string>
                <key>bundle-version</key>
                <string>1.3</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>AppName</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

回答1:


Your plist file should be hosted on HTTPS SSL enabled serve only otherwise you can not install it.

I have attached a sample manifest.plist file with sample data, you can modify with your original one.

<?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>https://127.0.0.0/app/App.ipa</string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>display-image</string>
                    <key>url</key>
                    <string>https://127.0.0.0/app/icon57.png</string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>full-size-image</string>
                    <key>url</key>
                    <string>https://127.0.0.0/app/icon512.jpg</string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.companyname.appname</string>
                <key>bundle-version</key>
                <string>1.0</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>Your application name</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

Place all the following files in same directory on your server.

  • App.ipa
  • icon57.png
  • icon512.jpg
  • manifest.plist

Your download URL should look like following.

itms-services://?action=download-manifest&url=https://127.0.0.0/app/manifest.plist

Example Click here to download App.

Also make sure your server supports MIME Type of application/octet-stream for ipa and text/xml for plist.



来源:https://stackoverflow.com/questions/37156632/download-inhouse-app-from-another-app-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!