Apple's new Mac App Store is an exciting opportunity for developers to gain increased exposure for their products. Developers are now able to show off their products to potentially millions of Mac users, all accessible from the desktop App Store tool that is installed with Mac OS X 10.6 (Snow Leopard). The best part of this opportunity is that it is not limited to Cocoa developers who code in Objective-C and use Xcode; Tcl/Tk developers with Mac versions of their programs can do so as well.
There are a number of steps one must follow to submit a product to the Mac App Store, and there are pitfalls specific to Tcl/Tk applications to avoid. This article will provide a basic overview of the submission process, and discuss in more detail the specific steps that Tcl/Tk developers should take to maximze the chances of their application being approved.
You must be a paid, reigstered developer with Apple before you can submit to the App Store or gain access to the tools and documentation needed to prepare your application. You can join the Mac Developer Program for $99, at this site:
http://developer.apple.com/devcenter/mac/index.action.
Once registered with the developer program, you will need to download and install the latest verison of Xcode, the iOS SDK, and the other application tools. See the App Store documents at Apple's developer site for links and version numbers. Xcode itself is not a required tool for preparing Tcl/Tk applications for submission; the installation also includes several command-line tools that Tcl/Tk developers will use extensively in the submission process.
Apple requires registered developers to obtain Apple-provided certificates for signing the application and the App Store installer. These certificates can be downloaded from Apple's developer site.
Once signed up with the Apple developer program, you can register your application with the App Store: its name, its Apple Bundle ID, screenshots, pricing, app store category, and other data. The application must be registered before it can be uploaded for review by Apple.
Assuming your application is complete and functional and does not need additional work simply to run as expected, you should review the App Store submission guidelines at Apple's site and take note of any areas where your application is not currently compliant. For instance, the application cannot write supporting data to any directory but ~/Library/Application Support or it will be rejected; if your application writes data to the user's home directory, to ~/Library/Preferences, or elsewhere, you will need to make adjustments to your code.
All Mac applications bundles come with a file called the application property list file (info.plist), which sets various keys and attributes for the program that are read by the operating system; these can include things like the version number, application name, copyright data, and more. There are some App Store-specific keys that must be set, including LSMinimumSystemVersionByArchitecture, LSArchitecturePriority, and LSApplicationCategoryType. (See the App Store guidelines for more details.) Both Wish and ActiveState-generated application bundles come with an info.plist file, and the appropriate data can be added to the file with a text editor or with Apple-provided tools.
There are a few different ways to deploy standalone Tcl/Tk applications on the Mac. One way is to use the tools provided by ActiveState (http://www.activestate.com/). Another is to create a standalone build of Wish with embedded Tcl/Tk frameworks as described at http://www.codebykevin.com/opensource/tutorial.html. In either case, the build should be Intel-only (no legacy PPC support). However, if you are using a Cocoa-based version of Tcl/Tk (which is recommended), there may be problems with these approaches. One of the App Store guidelines states that any application making calls to private frameworks or methods in Apple's frameworks will be rejected. Unfortunately, Tk-Cocoa makes extensive calls to private methods within Cocoa, at a low level; this design is necessary to implement Tk within the Cocoa API. If your application directly embeds the Tk-Cocoa frameworks (and both a standalone build of Tk-Cocoa Wish and an application bundle using an ActiveState Tk-Cocoa basekit do), then it may be rejected because these frameworks contain private function calls. The way to work around this issue is to link your application to the system Tcl/Tk frameworks (/System/Library/Frameworks/Tcl.framework and /System/Library/Frameworks/Tk.framework) and not deploy any embedded frameworks with your program. This works around the prohibition against private API calls because Apple-installed libraries are exempt from this requirement.
To link your application to the system Tk-Cocoa frameworks, you will need to use the install_name_tool CLI program. You can invoke this tool in this fashion:
install_name_tool -change
/Library/Frameworks/Tk.framework/Versions/8.5/Tk
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk
MyApp.app/Contents/MacOS/MyAppinstall_name_tool -change
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
/System/LibraryFrameworks/Tcl.framework/Versions/8.5/Tcl
MyApp.app/Contents/MacOS/MyApp
Rather than using serial numbers or license files, the Mac App Store uses App Store receipts to ensure the validity of the app installation. The subdirectory within the application bundle where the receipt is stored is MyApp.app/Contents/_MASReceipt; this directory can be added manually or as part of a build script. If this directory is not present, then the application may be rejected by the App Store reviewers.
Paid apps should validate their receipts. An open-source Tcl package incorporating receipt-validation code can be found at http://tk-components.sourceforge.net, based on code developed at https://github.com/roddi/ValidateStoreReceipt.
Once the application bundle is complete, you need to digitally sign the application bundle, change the permissions on the signed application bundle, and then prepare the App Store installer. You can use these commands to do so:
codesign -f -s "3rd Party Mac Developer Application: My Name"
MyApp.app
chmod -R 775 MyApp.app
productbuild --component MyApp.app /Applications \
--sign "3rd Party Mac Developer Installer: My Name" \
--product MyApp.app/Contents/Info.plist MyApp.pkg
The "codesign" tool applies your developer certificate to the app bundle. The "chmod" command sets the permissions to ensure that the application will succesfully launch after being packaged by Apple's installer tools. And finally, the "productbuild" command creates an App Store-specific installer package for your program. Apple's App Store documents have more information about this.
It is a good idea to test the installer. See Apple's guidelines for instructions on how to do this.
Finally, if the application installer works, then upload your .pkg file to Apple using Application Loader. Launch Application Loader, and if you have completed all the steps correctly, there should be a drop-down menu containing your app(s). Select the one you want to upload, click next and follow the steps. If you get the message "No eligible applications were found." then you likely made a mistake earlier in the process.
Finally, once you have uploaded the application, the waiting begins. You can monitor your application's status at Apple's site. Each time the application moves ahead in the review process, you will receive an e-mail. The review process can take a couple of weeks, so it helps to be patient. If the application is approved, then it will show up in the App Store a day or so later. If the application is rejected, you will receive an e-mail with information about why the app was rejected.
Good luck!

Home/Products
Blog
Open Source
Contact
Newsletter
Sales Policies
Credits
About