I am trying to create a bash script to automate the creation of in-app purchase pkg files.
I am at a point that the script creates successfully all in-app purchase xcodeproj projects and then archive them using this command
xcodebuild -scheme $nameOfProject archive
$nameOfProject is a variable that holds, inside a loop, the name of the xcodeproj file correspondent to the in-app purchase.
After doing this, I have to open the archive part of Xcode and manually export all archives to create the pkg files that I need to have to upload to iTC.
Is there any command that I can use to do this automatically from terminal?
Another thing that would provide the same solution would be: how to convert a xcarchive file into a pkg file?
After some googling and some testing with the "In-app purchase content" Project, I think that what you need to use is the
productbuild
command line tool. Since I am only iOS developer myself, I have no experience with creating installers but I am pretty sure the "pkg" file for the in-app content is created using this command line tools.To find the correct parameters you can refer to https://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/OSXWorkflowGuide/DistributingApplications/DistributingApplications.html#//apple_ref/doc/uid/TP40011201-CH5-SW1
or
man
.Edit:
To test what XCode does, I have created a simple project
And I archived it:
Then I created a simple program, let's call it
ArgumentLogger
, the code isLet's have an example - for bash command:
log.txt
will containNow, let's replace
/usr/bin/productbuild
with this programand then hit "Distribute" in XCode. and export the package.
log.txt
now containsNow we see exactly what XCode did.
The second file is the resulting file, I am not sure whether there is something more done with the file or not, but after expanding it with
pkgutil
, the contents seem to be the same as the ones in thepkg
created from XCode.The first file is a directory which seems to be taken directly from the
xcarchive
file. Let's see its contentsEdit 2:
In summary, the
bash
script should be something along the lines of: