Skip to content

Automating Application Loader for iOS

Did you know that Apple provides a command-line interface for the Application Loader? With a Post-Build IDE build script, you can automatically submit your iOS apps to the iTunesConnect for processing!

The command is:

xcrun altool -u [username] -p [password] -f [path to bundle] -t ios

In a Xojo build script you can even show a prompt asking if you want to submit it. Just make a post-build script and paste in this code.

dim btn As String = ShowDialog("Do you want to upload this build to Apple?", "", "Yes", "No", "")
if btn = "No" Then
  Return
end if

// Find the path to the .ipa file that was just built
Dim result as String = DoShellCommand("cd " + CurrentBuildLocation + " && ls -1 *.ipa")
Dim IPAPath As String = CurrentBuildLocation + "/" + ReplaceAll(trim(result), " ", "\ ")

// Make the command
Dim username as string = "Your iTunesConnect Username"
dim password as string = "Your iTunesConnect Password"
Dim cmd As String = "xcrun altool -u -p -f -t ios"
cmd = Replace(cmd, "", IPAPath)
cmd = Replace(cmd, "", username)
cmd = Replace(cmd, "", password)

// Validate the package (with a 2 minute timeout)
// If an error occurs, show the error and abort
Dim errorcode As Integer
result = DoShellCommand(cmd + " -v", 120, errorcode)
If errorcode <> 0 Then
  print result
  Return
End If

// Upload the package (with a 15 minute timeout)
// If an error occurs, show the error and abort
result = DoShellCommand(cmd + " --upload-app", 900, errorcode)
If errorcode <> 0 Then
  print result
  Return
End If

Print "Upload Complete."

For more information about this powerful command-line tool, open a Terminal and type:

xcrun altool -h