Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling openURL to install App OTA results in installing a cached app

I'm creating an in-house app to deliver updated apps that our business clients can install wirelessly.

Ultimately the way I'm launching the install is:

NSURL *otaURL = [NSURL URLWithString:@"itms-services://?action=download-manifest&url=<<my-url.plist>>"]; 
[[UIApplication sharedApplication] openURL:otaURL];

This works fine but we've noticed that it will sometimes keep a cache of the plist or the ipa file and install an old version. We have ruled out that it's not updating on the server because we can even delete the ipa file from the server and it will still install an old version.

Changing the .plist and .ipa file name will work but isn't really the desired end state so my question is: Is there a way to force the device to go out and get the file from the server instead of relying on it's cache?

like image 581
Trey Avatar asked Sep 06 '12 13:09

Trey


1 Answers

I had a very similar issue, and I solved it with a (dirty) workaround; still better than creating a different .plist file for each new version.

I insert some random numbers in the url such as:

 NSURL *otaURL = [NSURL URLWithString:[NSString stringWithFormat:@"itms-services://?action=download-manifest&url=myapp.%d.plist", arc4random() % 10000]; 
 [[UIApplication sharedApplication] openURL:otaURL];

On the other side, I add a rule in .htaccess (supposing Apache, configured with mod_rewrite):

AddType application/octet-stream ipa
AddType text/xml plist

RewriteEngine on
RewriteRule (.*)\.\d+\.plist $1.plist
like image 200
etienne Avatar answered Oct 24 '22 09:10

etienne