Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to make a download link to my IOS app. This, as we all knows, requires a .plist file with all the informations regarding the app. I would like to make the download link, without having to create a file. I have tried to do it, but it does not work. I maybe think, it is because the link contains "url", which just points to the XML it selfs. Any ideas?

I have used this library: https://github.com/TooTallNate/plist.js


What I have tried:

Pastebin: https://pastebin.com/0fTqweYP
Posted
Updated 4-Apr-19 2:07am
Comments
#realJSOP 4-Apr-19 6:41am    
If it requires a plist file, what makes you think you can do it without a plist file?
AndersFlyingApple 4-Apr-19 7:46am    
I am trying to avoid creating the file, by simply passing the files content to the user. Is there a way to avoid physically creating a file?

1 solution

Quote:
var plistBuildAndParsed = plist.build(plist.parse(plistData));

Based on a quick read of the documentation for that GitHub project[^], all that line is going to do is convert your plist XML to JSON, then convert the JSON back to the equivalent plist XML.

If you debug your code, you'll probably see that the URL you're trying to launch looks something like:
itms-services://?action=download-manifest&url=<?xml version="1.0" ...

Obviously, the contents of the plist XML file is not a valid URL.

In a supported browser, you could combine URL.createObjectURL[^] with a Blob[^] to generate a URL for your XML file. Unfortunately, the Blob API doesn't seem to be supported on iOS.

You could try a data: URI[^] instead:
JavaScript
var plistUrl = "data:text/xml," + encodeURIComponent(plistBuildAndParsed);
link.setAttribute("href", "itms-services://?action=download-manifest&url=" + encodeURIComponent(plistUrl));
 
Share this answer
 
Comments
AndersFlyingApple 5-Apr-19 4:09am    
Ty for answering! :) Tried doing this, but the app still wont install on my Iphone.. I get the error "Cannot install apps because the certificate for (null) is invalid"
Richard Deeming 5-Apr-19 7:27am    
It sounds like that protocol will only work with an https:// URL then. If you don't want to create a static plist file, you'll need some code running on the server to create it on demand. How you do that will depend on which server you're using, and which server-side language(s) it supports.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900