Page 1 of 1

install iOS app from AppStore IPA programmatically

PostPosted: Thu May 04, 2017 2:05 pm
by septium
I want to be able to install free AppStore IPAs by myself.
Here are the steps of my small experiment:

1. I started to watch for the changes in /var/mobile/Media/Downloads/downloads.28.sqlitedb to obtain valid examples of direct IPA download URLs.
Successfully found some long URLs, surprisingly in plain old HTTP :)

Code: Select all
http://iosapps.itunes.apple.com/apple-assets-us-std-000001/Purple82/v4/28/6b/70/286b70e4-f9be-889f-6699-ab9a1bd1ea97/pre-thinned2607683962902273891.thinned.signed.dpkg.ipa?accessKey=1494051311_9106627041037073415_lzuCaqXGENowCmTlrK0a73pDLKfn83IyTHnvLLcuTUgdfsDu7G%2BVrImgOa58CEASBPWIpIXkaKoGR3dd7ppU6YA5NKrj2JE50wUALKVvaR%2BiJl7x9vtWxtXakLhJjRBe%2BmcP6%2FOPMGK6g1MQNVa7JPn%2BBxF4A2B8ov0T6uIZ241%2FmFKkQQTAoVzL0gJYh3RCrN9Y%2FOZvnje5uLpoe9p0vUMBjZDcZ692IkMVt7V6jF8%3D


2. Downloaded IPA with curl. Success.

3. Tried to install it using -[MIInstallerClient installPath:withOptions:completion:] from MobileInstallation.framework
(I have iOS 9.3.2, in iOS 10 MIInstallerClient is slightly different).
Completion block bitched on missing entitlements. Copied them from itunesstored.
After that the installation was reported to finish successfully by completion block.

Code: Select all
...
NSBundle *miBundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/MobileInstallation.framework"];
if ([miBundle load]) {
    Class miicClass = [miBundle classNamed:@"MIInstallerClient"];
    if (miicClass) {
        self.mii = [miicClass installerWithProgressBlock:^(id arg1) {
            NSLog(@"Progress %@", arg1);
        }];
       
        [self.mii installPath:tmpIpaPath withOptions:@{@"ApplicationType": @"User"} completion:^(BOOL status, NSError *err) {
            outerCompletion(status, err);
        }];
    }
}
...


4. Used uicache to refresh springboard caches. App had appeared on SB.

5. Launching failed on fairplay decryption.

After that I had noticed that newly created app container is missing iTunesArtwork and iTunesMetadata.plist which are present after sane AppStore installation.

Does anybody knows how to replicate itunesstored functionality and install IPAs programmatically?

Re: install iOS app from AppStore IPA programmatically

PostPosted: Thu May 04, 2017 7:57 pm
by Siguza
I have no experience with IPA installation whatsoever, but there's a command line utility called ipainstaller that works on iOS 9 and is open source.

Re: install iOS app from AppStore IPA programmatically

PostPosted: Tue May 30, 2017 3:38 pm
by septium
Siguza wrote:ipainstaller


Thank you, this code helped me.