Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

how to distribute iPhone test app: Difference between revisions

From MoodleDocs
(Created page with "1. In Xcode 4 select iOS Device / your own device. Then Product > Archive 2. Open organizer, you should see an archive of your app in Archives tab.. This is the app you want to ...")
 
No edit summary
Line 18: Line 18:
<code>
<code>
<?php
<?php
$ipas = glob('*.ipa');
$ipas = glob('*.ipa');
$provisioningProfiles = glob('*.mobileprovision');
$provisioningProfiles = glob('*.mobileprovision');
$plists = glob('*.plist');
$plists = glob('*.plist');
 
$sr = 'http://jerome.moodle.local/~jerome/'; //YOUR WWWROOT
 
$provisioningProfile = $sr . $provisioningProfiles[0];
    $sr = 'http://jerome.moodle.local/~jerome/'; //YOUR WWWROOT
$ipa = $sr . $ipas[0];
    $provisioningProfile = $sr . $provisioningProfiles[0];
$itmsUrl = urlencode( $sr . 'index.php?plist=' . str_replace( '.plist', '', $plists[0] ) );
    $ipa = $sr . $ipas[0];
if ($_GET['plist']) {
    $itmsUrl = urlencode( $sr . 'index.php?plist=' . str_replace( '.plist', '', $plists[0] ) );
$plist = file_get_contents( dirname(__FILE__)  
 
. DIRECTORY_SEPARATOR  
 
. preg_replace( '/![A-Za-z0-9-_]/i', '', $_GET['plist']) . '.plist' );
    if ($_GET['plist']) {
$plist = str_replace('_URL_', $ipa, $plist);
        $plist = file_get_contents( dirname(__FILE__)  
header('content-type: application/xml');
                . DIRECTORY_SEPARATOR  
echo $plist;
                        . preg_replace( '/![A-Za-z0-9-_]/i', '', $_GET['plist']) . '.plist' );
die();
                            $plist = str_replace('_URL_', $ipa, $plist);
}
                                header('content-type: application/xml');
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                                    echo $plist;
"http://www.w3.org/TR/html4/loose.dtd">
                                        die();
<html>
                                        }
<head>
 
<title>Install iOS App</title>
 
<style type="text/css">
                                        ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
li {
                                                "http://www.w3.org/TR/html4/loose.dtd">
padding: 1em;
                                                <html>
}
                                                <head>
</style>
                                                <title>Install iOS App</title>
</head>
                                                <style type="text/css">
<body>
 
<ul>
                                                li {
<li><a href="<?php echo $provisioningProfile; ?>">Install Team Provisioning File</a></li>
                                                    padding: 1em;
<li><a href="itms-services://?action=download-manifest&url=<?php echo $itmsUrl; ?>">
                                                    }
Install Application</a></li>
 
</ul>
                                                    </style>
</body>
                                                    </head>
</html>
                                                    <body>
                                                    <ul>
                                                        <li><a href="<?php echo $provisioningProfile; ?>">Install Team Provisioning File</a></li>
                                                            <li><a href="itms-services://?action=download-manifest&url=<?php echo $itmsUrl; ?>">
                                                                    Install Application</a></li>
                                                                    </ul>
                                                                    </body>
                                                                    </html>
 
</code>
</code>


11. The tester can now access the page to install the app. She/He must click on 'Install provisioning profile' the first time, then she/must directly install te app the next time. For update she must delete her previous version first.
11. The tester can now access the page to install the app. She/He must click on 'Install provisioning profile' the first time, then she/must directly install te app the next time. For update she must delete her previous version first.

Revision as of 07:15, 13 June 2011

1. In Xcode 4 select iOS Device / your own device. Then Product > Archive 2. Open organizer, you should see an archive of your app in Archives tab..

This is the app you want to distribute.

Optional - you want to add a new testing device (NOTE: STEP 6 must be done the first time even if no new device are added) 3. Go to https://developer.apple.com/ios/manage/devices/index.action 4. Add an iPhone UID. To know the UID, just plug the iPhone in your Mac/PC. The 40 numbers identifier is displayed either in iTunes, either in Organizer. The tester most likely will have to give you her/his UID as you probably don't have access to her/his iPhone 5. Go back into Organizer > Devices tab > Library > Provisioning Profiles (left pane, at the top). Select Team Provisioning Profile. 'Automatic Device Provasioning' should be checked. Click on Refresh button. The Team Provisioning profile should be updated and in the Devices list you should see the new device lister. 6. Click on export and save the Team Provisioning profile in your dirroot on your web server.

7. in Archives tab, select your app and click on Share. 8. Select iOS ipa and in Identity, select the The Team Provisioning (most likely the last one). Press Next. 9. Select 'Save for Entreprise Distribution'. Enter the url where you want to distribute the app (for example http://wwwroot/MoodleApp.ipa). As title enter the same name (for example MoodleApp). Finally Save As the same name too (for example MoodleApp) in your dirroot

10. In dirroot, write the following php script

<?php $ipas = glob('*.ipa'); $provisioningProfiles = glob('*.mobileprovision'); $plists = glob('*.plist'); $sr = 'http://jerome.moodle.local/~jerome/'; //YOUR WWWROOT $provisioningProfile = $sr . $provisioningProfiles[0]; $ipa = $sr . $ipas[0]; $itmsUrl = urlencode( $sr . 'index.php?plist=' . str_replace( '.plist', , $plists[0] ) ); if ($_GET['plist']) { $plist = file_get_contents( dirname(__FILE__) . DIRECTORY_SEPARATOR . preg_replace( '/![A-Za-z0-9-_]/i', , $_GET['plist']) . '.plist' ); $plist = str_replace('_URL_', $ipa, $plist); header('content-type: application/xml'); echo $plist; die(); } ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Install iOS App</title> <style type="text/css"> li { padding: 1em; } </style> </head> <body>

  • <a href="<?php echo $provisioningProfile; ?>">Install Team Provisioning File</a>
  • <a href="itms-services://?action=download-manifest&url=<?php echo $itmsUrl; ?>"> Install Application</a>

</body> </html>

11. The tester can now access the page to install the app. She/He must click on 'Install provisioning profile' the first time, then she/must directly install te app the next time. For update she must delete her previous version first.