Website File Layout
- name.com/index.php (iPhone Site, optional but recommended)
- name.com/application/index.php (Basic Auto Link Creating Site)
- name.com/application/application.ipa (only file that needs to be updated)
- name.com/application/application.plist
- name.com/application/application57.png
- name.com/application/application512.png
- name.com/application/Application_Distribution_Profile.mobileprovision
Solution using Automator:
First Action: Run Shell Script to Build & Archive and save to a .ipa file. It may take a while to figure out how to modify this to fit your situation as it did with me (This may not work with XCode 4, and if you have issues just build and archive inside XCode)
PROJDIR="/Users/username/Xcode/applicationfolder"
PROJECT_NAME="application"
APPLICATION_NAME="Application"
TARGET_SDK="iphonesimulator4.0"
PROJECT_BUILDDIR="${PROJDIR}/build/Distribution-iphoneos"
TARGET_TEST_NAME="application"
BUILD_HISTORY_DIR="${PROJDIR}/distribution/" #where you want the .ipa to go
DEVELOPER_NAME="First Last (TMTE9G3NGS)"
PROVISONING_PROFILE="/Users/username/Xcode/Application_Distribution_Profile.mobileprovision"
# compile project
echo Building Project
cd "${PROJDIR}"
xcodebuild -target "${PROJECT_NAME}" -sdk "${TARGET_SDK}" -configuration Distribution
#Check if build succeeded
if [ $? != 0 ]
then
exit 1
fi
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
Action Two: Get Finder Item
The application .ipa file that was just saved.
Action Three: Upload to FTP Server
Google for the script (cant post url) its at automatorworld dot com though, should be easy to find. Use that script to upload the file to where you want it. In my case name.com/application/application.ipa
Now for the website end of the things.
If you want to have a basic way for users to download the file just put the index.php file (created below), the Application.plist file (created below), the .ipa file and the 57 pixel and 512 pixel image in a folder.
I have gone one step further and created an iPhone HTML site that you can go to that also shows when the file was last updated. You can create that site using this template: http://snipt.org/vmup/ I had to use the basic site to copy the url that it created for the links to the ipa and mobileprovision. Here is a snippet that I have for the link with an auto updating Last Updated date. For the last updated text to work I had to change the file to a .php
<li><a href="URL FROM BASIC SITE HERE"><span class="menuname">Install Application Name</span><span class="itemarrow"></span></a></li>
<sup>
Last Updated: <?= date("m/d/Y H:i",filemtime("applicationfolder/application.ipa")) ?> (TIME ZONE HERE)
<sup>
Basic Auto link creating application index file:
<?php $ipas = glob('*.ipa'); $provisioningProfiles = glob('*.mobileprovision'); $plists = glob('*.plist'); $sr = stristr( $_SERVER['SCRIPT_URI'], '.php' ) === false ? $_SERVER['SCRIPT_URI'] : dirname($_SERVER['SCRIPT_URI']) . '/'; $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> <ul> <li><a href="<? echo $provisioningProfile; ?>">Install Team Provisioning File</a></li> <li><a href="itms-services://?action=download-manifest&url=<? echo $itmsUrl; ?>"> Install Application</a></li> </ul> </body> </html>
Application plist file:
<?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>IPA FILE LINK HERE</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>URL FOR 512 PIXEL IMAGE HERE</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>URL FOR 57 PIXEL IMAGE HERE</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>COM.COMPANY.APPLICATION</string>
<key>bundle-version</key>
<string>VERSION NUMBER HERE (YOU DON'T REALLY NEED TO UPDATE IT UNLESS YOU WANT TO)</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>APPLICATION NAME HERE</string>
</dict>
</dict>
</array>
</dict>
</plist>