Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside

#OSX Generated Stuff
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# Custom
DerivedData/*
*/DerivedData/*
coverage.xml
test-report.xml
*/test-reports/*
*.xarchive

# ITMS
itms/*
environment-local.sh
55 changes: 36 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,57 @@ This script helps prepare localized screenshots for delivery to iTunes Connect v
***

#### Step 1
Open your app in iTunes Connect and create a new version. Ensure your app is listed in the "Prepare for Upload" status. Download your app's metadata package from Apple.
Open your app in iTunes Connect and create a new version. Ensure your app is listed in the "Prepare for Submission" status. Download your app's metadata package from Apple using the download script.

ITMSUSER=YourItunesUsername
ITMSPASS=YourItunesPassword
ITMSSKU=YourAppSKU
PATH="$PATH:/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/bin/"
iTMSTransporter -m lookupMetadata -u $ITMSUSER -p $ITMSPASS -vendor_id $ITMSSKU -destination ~/Desktop
> `download-metadata.sh`

This will save the .itmsp file to your desktop.
This will save the .itmsp archive to the directory you specify, defaulting to `./itms/<bundleid?>itmsp`. You'll also find a new screenshots directory under there too.

#### Step 2
Take screenshots and save them to `~/Desktop/screenshots` with the format like
Take screenshots and save them to this new directory `./itms/screenshots-raw` with the format like

> `cmn-Hans___ios4in___portrait___screen1.png`
> `en-GB___iOS-4-in___screen1.png`

This is comprised of sections delimited by `___`:
This is comprised of case sensitive sections delimited by three underscores `___`:

- Device name: correct names are `Mac`, `iOS-3.5-in`, `iOS-4-in` or `iOS-iPad`
- Locale: like `es-ES`, `fr-FR`, `ja-JP`, `en-US`, **HELP: NEED HELP FULLY DOCUMENTING LOCALE NAMES IN ITMS**
- Device: Correct names are (currently) `Mac`, `iOS-3.5-in`, `iOS-4-in`, `iOS-4.7-in`, `iOS-5.5-in` or `iOS-iPad`
- Locale: like `es-ES`, `fr-FR`, `ja-JP`, `en-US`, `en-CA`, `en-GB`, `en-AU`, `cmn-Hans`, `cmn-Hant` **HELP: NEED HELP FULLY DOCUMENTING LOCALE NAMES IN ITMS**
- Orientation: optional (`portrait`)
- Screen: screenN where N is the ordering for it when uploaded `(1,2,3,4,5)`
- Extension: always use .png

Optional: write a UI script and automate generation of screenshots for all devices and localizations using https://github.com/jonathanpenn/ui-screen-shooter Note: if your screenshots are in the format `Locale/Devicename___other.png`, fix this with: `for a in */*; do d=$(dirname $a); f=$(basename $a); mv $a ${d}___${f}; done; rmdir */`

If you are unsure of any country codes, check the `metadata.xml` file that is downloaded in step 1

The files can be in subdirectories as they will be flatted in the next step

#### Step 3
Run `php screenshots.php` – this will add the XML chunks you need and make a fresh copy of your `metadata.xml` in the screenshots folder.
Prepare the screenshots you have generated by running the verify script.

> `prepare-screenshots.sh`

This will make a copy of your screenshots, flattened from the `screenshots-raw` version, in the .itmsp package, ready for upload.

#### Step 4
Copy the contents of "screenshots" on your desktop into the itmsp file on your desktop (right-click -> show package contents to access the latter). Or use the following command:
Generate a new metadata file for the new screenshots.

cp ~/Desktop/screenshots/* ~/Desktop/*.itmsp
> `php screenshots.php`

This will add the XML chunks you need and write an updated copy of your `metadata.xml` in the `$ITMSFOLDERNAME` folder.
A copy of what was actually generated will also be written to `xml_chunks_DEBUG.txt`. This DEBUG file can be discarded if not needed.

#### Step 5
Verify your upload:
Verify the content you have generated can be uploaded by running the verify script.

iTMSTransporter -m verify -u $ITMSUSER -p $ITMSPASS -vendor_id $ITMSSKU -f ~/Desktop/*.itmsp
> `verify-metadata.sh`

Error "software_screenshots cannot be edited in the current state" happens if your app is currently being reviewed.

#### Step 6
If things went well, execute your upload:
All being well, you can perform the actual upload

iTMSTransporter -m upload -u $ITMSUSER -p $ITMSPASS -vendor_id $ITMSSKU -f ~/Desktop/*.itmsp
> `upload-metadata.sh`

-----------------

Expand All @@ -56,6 +66,13 @@ You can modify Xcode schemes to automatically launch your app in a particular lo
On top of that, I wanted localized users for my screenshots, so I pass an Environment Variable of "USER_ID", then grab that in my code & setup the user programmatically. You can get Environment Variables via:
[[NSProcessInfo processInfo] environment]

You can speed things up by having a file called `environment-local.sh` in which you define the details that you are otherwise prompted for:

ITMSUSER='myitmsusername'
ITMSPASS='myitmspassword'
ITMSSKU=com.myapp.sku

All of the shell scripts will use this instead, if available.

## Heads Up

Expand Down
8 changes: 8 additions & 0 deletions download-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
. environment.sh

echo "Downloading..."

iTMSTransporter -m lookupMetadata -u $ITMSUSER -p $ITMSPASS -vendor_id $ITMSSKU -destination $ITMSFOLDERNAME

echo "itmsp package is now at $ITMSFOLDERNAME"
echo "Now put your screenshots into $ITMSSCREENSHOTSFOLDERRAWNAME and run prepare-screenshots.sh"
42 changes: 42 additions & 0 deletions environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
if [ -f "environment-local.sh" ];
then
echo "Using local environment variables in environment-local"
. environment-local.sh
fi

ITMSFOLDERNAME=./itms
ITMSSCREENSHOTSFOLDERRAWNAME="$ITMSFOLDERNAME/screenshots-raw"

PATH="$PATH:/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/bin/"

if [ -z "$ITMSUSER" ];
then
read -p "Username:" ITMSUSER
fi

if [ -z "$ITMSPASS" ];
then
read -s -p "Password:" ITMSPASS
echo ""
fi

if [ -z "$ITMSSKU" ];
then
read -p "SKU:" ITMSSKU
fi

if [ -d "$ITMSFOLDERNAME" ];
then
echo "Directory $ITMSFOLDERNAME already exists. This might be expected but it might mean old assets lying around"
else
echo "Making directory $ITMSFOLDERNAME for the itmsp package"
mkdir $ITMSFOLDERNAME
fi

if [ -d "$ITMSSCREENSHOTSFOLDERRAWNAME" ];
then
echo "Directory $ITMSSCREENSHOTSFOLDERRAWNAME already exists. This might be expected but it might mean old screenshots lying around"
else
echo "Making directory $ITMSSCREENSHOTSFOLDERRAWNAME for the screenshots"
mkdir $ITMSSCREENSHOTSFOLDERRAWNAME
fi
9 changes: 9 additions & 0 deletions prepare-screenshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
. environment.sh

echo "Ensuring screenshots are flattened and in place in the package..."

for i in `find $ITMSSCREENSHOTSFOLDERRAWNAME -name \*.png -print`; do
cp -v -f $i "$ITMSFOLDERNAME/$ITMSSKU.itmsp/"
done

echo "Now run php screenshots.php to splice in the new screenshots"
33 changes: 12 additions & 21 deletions screenshots.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
<?php
#
# Put your screenshots in the INPUT_DIR and name them like:
# en_US___ios4in___portrait___screen1.png
# en_US___ios-4-in___portrait___screen1.png
# OR
# en_US___ios4in___screen1.png
# en_US___ios-4-in___screen1.png
#
$user_home_dir = $_SERVER['HOME'];
$screen_shots_dir = "$user_home_dir/Desktop/screenshots";
$itmps_dir = "$user_home_dir/Desktop";

$ITMSFOLDERNAME = "itms";
# $screen_shots_dir = "$ITMSFOLDERNAME/screenshots";
$itmps_dir = "$ITMSFOLDERNAME";

$itmsps_dirs = glob("$itmps_dir/*.itmsp");
$screen_shots_dir=$itmsps_dirs[0];

/*
* STEP 1: INHALE SCREEN SHOTS
Expand Down Expand Up @@ -73,8 +77,9 @@
echo "Saved XML chunks of ".count($screen_shots_by_locale_and_device, COUNT_RECURSIVE)." screen shots to $screen_shots_dir/xml_chunks_DEBUG.txt\n";

if (isset($itmsp_parsed)) {
$itmsp_parsed->asXML("$screen_shots_dir/metadata.xml");
echo "Saved updated metadata.xml file to $screen_shots_dir/metadata.xml\n";
$itmsp_parsed->asXML("$itmsps[0]");
echo "Saved updated metadata.xml file to $itmsps[0]\n";
echo "Now you can run verify-metadata.sh to check it all looks fine\n";
}

function xmlChunk($display_target, $position, $file_path, $file_name)
Expand All @@ -90,17 +95,3 @@ function xmlChunk($display_target, $position, $file_path, $file_name)
</software_screenshot>
END;
}


function translateDevice($device)
{
if ($device == 'iphone4') {
return 'iOS-3.5-in';
} elseif ($device == 'iphone5') {
return 'iOS-4-in';
} elseif ($device == 'ipad') {
return 'iOS-iPad';
} else {
print "\n\n\n******\n\nWTF $device\n\n\n";
}
}
7 changes: 7 additions & 0 deletions upload-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
. environment.sh

echo "Uploading..."

iTMSTransporter -m upload -u $ITMSUSER -p $ITMSPASS -vendor_id $ITMSSKU -f "$ITMSFOLDERNAME/$ITMSSKU.itmsp"

echo "Done!"
5 changes: 5 additions & 0 deletions verify-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
. environment.sh

echo "Verifying..."

iTMSTransporter -m verify -u $ITMSUSER -p $ITMSPASS -vendor_id $ITMSSKU -f "$ITMSFOLDERNAME/$ITMSSKU.itmsp"