revUp - Updates and news for the LiveCode community
Issue 112 | June 17th 2011 Contact the Editor | How to Contribute

Mac App Submit
A step by step set of instructions for success in submitting your application to the Desktop Mac App Store

This article was kindly contributed by an anonymous user who has successfully submitted an application to the Mac App store using this process, and wanted to share their findings with the community.

June 2011, Snow Leopard 10.6.7.

1. Get a Mac Dev Center Account

This takes days to finalize so do this first. You will need to:

Register as an Apple Developer

Choose the Mac Dev Center.

Once you have a developer account, buy the "Mac Developer Program". You want Programs & Add-ons, Mac Developer Program.

When you create your Mac Developer account, you will be asked for your legal entity name. A version of the legal entity name you submit is what is going to appear in the Mac App Store. If you do not want your personal name to be the developer name for your products, create a corporation so that your legal entity name can be your corporate name. For example, if your legal entity name is "Barn Door App Development, LLC" you might choose a display name of "Barn Door". But if your legal entity name is "Jane Dough", your choices are probably limited to "J Dough" or "Jane Dough". Once your account has a display name that's it, you will be stuck with it forever. So if you want the name to be your company name, make sure it is a legal entity.

2. Get the correct processor and operating system version.

Make sure your computer has an Intel processor. In the "Apple" menu, select the "About This Mac" menu item. The processor description will include the word "Intel".

Make sure you are running the most recent Mac OS X version. In the "Apple" menu, select the "Software Update..." menu item. Keep running Software Update until it tells you that "Your software is up to date."

3. Set up Standalone Application Settings in LiveCode

3a. General

Enter the name of your standalone application in "Standalone name:". In this example, the formal name of this application is "MyLiveCodeApp".

3b. Mac

Standalone settings

Only select build for "Mac OS X (Intel Only)". Deselect all the other "build for" options.

Application Icon: Select the file that contains your "application icon" (actually the same application icon at various sizes). Your application icon can start as a 512x512 pixel image. The free Apple application Icon Composer can be used to convert a 512x512 pixel image into the various icon sizes needed by your Macintosh application. Assuming you have downloaded Xcode from Apple and installed it on your computer, it is located at /Developer/Applications/Utilities/Icon Composer.app. Open Icon Composer and drag the 512x512 image of your icon into the 512x512 image tile and into the 128x128 image tile. Save and it creates a .ins file. Select this file as your Application Icon.

Document Icon: If your application creates documents with a file name suffix that is unique to your application, select the .ins file that contains your "document icon" (again, it is the same document icon at various sizes).

Icons to display on ask and answer dialogs: The "Application Icon" should be 64x64 pixels and the "Small Application Icon" should be 32x32 pixels. To create the 64x64 pixel icon, in the Finder create two copies of the 512x512 image and rename them as your 64x64 and your 32x32 image. For example "MyAppIcon 64x64.png". Open "MyAppIcon 64x64.png" in Apple's Preview. In the "Tools" menu, select the "Adjust Size..." menu item. Change the "Width:" and "Height:" units to "pixels" and then change the "Width:" value to 64. Press "OK" and Save the file. Repeat with the process with the 32x32 image. To be able to select these icons, they need to be imported into your stack. In your LiveCode stack, while at the first card, in the "File" menu, "Import As Control" menu item, select the "Image File..." sub-menu item and select the 64x64 pixel image file (in this example "MyAppIcon 64x64.png"). Import As Control the 32x32 pixel image file. Now click on the "Application Icon" "Select an icon" button, and in "Image Library: This Stack" select the icon (it is the larger of the two). Repeat for the "Small Application Icon" by selecting the smaller icon. Note the icon IDs when you are selecting these icons in the image library.

Make sure these icons are used by your application. Also make sure you do not delete these images and cause them to get removed from the stack image library. The following script hides the images within the first card of your application. For the standalone you don't need to set the gRevAppIcon(s) in a script because the standalone builder does that automatically. The commented code shown below can be uncommented to have these icons displayed when you are using the development environment. Note: in this example script, the icon ID assigned to "MyAppIcon 64x64.png" is 1003, and for "MyAppIcon 32x32.png" it is 1004.

on preopenstack
   -- global gRevAppIcon, gRevSmallAppIcon
   -- set "1003" into gRevAppIcon
   -- set "1004" into gRevSmallAppIcon
   hide image "MyAppIcon 64x64.png"
   hide image "MyAppIcon 32x32.png"
end preopenstack

PLIST: Select "Enter the information and have Revolution write the PLIST file for you". I prefer to have the LiveCode standalone preferences create the plist file that gets embedded in your standalone application and then to modify it as needed with the remaining required data. "Name:" should be the same as was previously entered in the General window, Standalone name: field. If you have a unique document type, enter its suffix in the "Document Type:" and "Document Extension:" fields. Not sure why there are two places to enter the document type suffix. In this example this application produces documents with the mlcdoc file extension, for example "Saved Stuff.mlcdoc".

Version Information: I recommend a simple version of number dot number dot number (without the fourth number that is displayed by default by LiveCode). The "Long Version:" and "Get Info String:" should include your application name (same as the PLIST Name) and the same version number used in "Short Version:". The "Copyright Notice:" should include the name of the copyright holder (which is either your name or a company name). Fill in the "Bundle Identifier:" so that it is your domain in reverse. For example, if your internet domain is "bizpro.net" and your app is "Biz Pro 2000" your bundle identifier should probably be "net.bizpro.bizpro2000" unless you have used that for some other application previously. The bundle identifier should be a string that is unique for this application.

Register your bundle identifier with Apple. Log into your Apple Developer account. Go to the home page and go to the "Developer Certificate Utility" section. Click on the "Mac App IDs" icon to see your list of registered Mac OS X App IDs (which is probably empty). Click on the "+ Create App ID" button and register your bundle identifier. For "App ID Name or Description" enter your application name (in this example "MyLiveCodeApp"). For the "App ID (Bundle Identifier)" enter your reverse domain name bundle identifier (in this example "com.mycompany.mylivecodeapp"). If that App ID is already registered by someone else, you'll need to pick a different bundle identifier and change that data in the Version Information window.

3c. Windows

Deselect Build for: Windows.

3d. Unix

Deselect Build for: Linux.

4. Select an Mac App Store Application Category Type.

Log into the Apple Developer Member Center. Go to the Mac Dev Center and go to the document titled "Submitting to the Mac App Store". One section in that document is titled "Categorize Your Application". Choose the most appropriate category from the list provided. The text you will use as your application category type is the text before the colon. For example, if you were to choose "public.app-category.entertainment: Entertainment" the category type you will enter later into your application plist is "public.app-category.entertainment".

While you are looking at Category Types, pick a secondary category type (if you think there is one). There is an optional secondary type that you can specify during the upload process.

5. Make sure your application follows all the Apple guidelines.

In the Mac Dev Center is a document titled "Mac App Store Review Guidelines". Read it and make sure your application complies with each guideline.

If you create a preference file for your application, make sure you store it in one of the three locations approved by Apple as detailed in the document "Submitting to the Mac App Store: File-System Usage Requirements for the App Store"

~/Library/Application Support/<app-identifier>
~/Library/<app-identifier>
~/Library/Caches/<app-identifier>

where <app-identifier> can be your application's bundle identifier, its name, or your company's name. These strings must match what you provided through iTunes Connect for your application. Most Cocoa apps store preferences as a plist, and thus for this example, assuming you are also storing data as a plist, the preference file would be named: "com.mycompany.mylivecodeapp.plist". I store preferences as text so mine is named: "com.mycompany.mylivecodeapp.txt".

The most appropriate place for preferences appears to be a folder for your application within the user's Application Support directory. To get that path you can use the LiveCode function specialfolderpath("Preferences") and then replace the final Preferences directory with "Application Support". Although it is not required that your application store it's preferences inside a folder in Application Support, most apps do so I recommend you create a folder for your application files and inside that folder store your preferences file. The final path to the preferences file becomes:

~/Library/Application Support/My LiveCode App/com.mycompany.mylivecodeapp.txt

where "~" is the universal symbol for "the user's account on this computer". In the actual path to the preferences file, that tilde would be the user account.

6. Save As Standalone

Create Standalone Application.

Remove the unused lprog folders in the standalone app. To open the standalone application package, select the standalone application in the Finder. At the top border of the Finder window where the standalone is selected, select the gear button, and in its drop down menu, select the menu item "Show Package Contents". In the "/Contents/Resources" folder, select and delete all .lprog folders for languages that your application does not support. For an English language only application, the only lprog folder that should remain is "English.lprog". All the other files/folders that are not ".lprog" should be left as is.

Edit Info.plist to include information not automatically inserted by LiveCode. "Info.plist" is in the "Contents" folder inside the application package. Double click on "Info.plist" to open it with "Property List Editor" (provided in the Apple Developer tools assuming you installed those). Change the view to display the raw key values. In the "View" menu select the "Show Raw Keys/Values" menu item. Select the key "Information Property List" and press the "Add Child" button. A list of possible keys to add will be displayed, because it is not in the list, manually type "LSApplicationCategoryType". For the value enter the previously chosen Mac App Store Application Category Type from the list of allowed category types provided by Apple. For this example we are entering "public.app-category.entertainment". Save your changes.

pList

7. Create a Keychain certificate for your application.

Log into your Apple Developer account. Go to the home page and go to the "Developer Certificate Utility" section. Click on the "Mac Certificates" icon to see your list of Mac OS X Certificates (which is probably empty). Click on the "+ Create Certificate" button. You want to create both a "Mac App Software Certificate" and a "Mac Installer Package Certificate". For "Email:" enter the email you wish for Apple Developer Relations to use to contact you. For "Common Name:" it is good practice to enter the name they know you by and in their example they appended "Dev Key" to that. For example if you are "J Dough" perhaps your common name would be "J Dough Dev Key". When you select "Request is: Saved to disk" the field named "CA Email Address:" is no longer required and can remain empty.

Jane Dough

8. Run Code Signature "codesign" in Terminal

I am not that comfortable with the command line interface in Terminal. My coping strategy is to specify absolute pathways to files rather than moving the Terminal session to the directory where a file is located and typing the file name. Absolute pathways seem to always work. The way to enter the absolute pathway to a file is to drag the file (or folder) icon into Terminal. Terminal will enter the correct absolute path in a format that works on the command line (escaping spaces, etc).

Open Terminal and enter "codesign -f -s " (there is a space after "-s" and you do not enter the quotes). Enter a start quote and then the full name of the Mac Developer Application certificate which is viewable with the Keychain application, followed by a closing quote. The image above of the Keychain shows the text that gets entered. In this example the command line should look something like:

jdough:~ jdough$ codesign -f -s "3rd Party Mac Developer Application: J Dough"

type a space after the closing quote and then in the Finder drag your standalone application file into the Terminal. Terminal will put the absolute path to the standalone application. The final line will look something like:

jdough:~ jdough$ codesign -f -s "3rd Party Mac Developer Application: J Dough" /Users/jdough/Documents/MyLiveCodeApp/MyLiveCodeApp/MyLiveCodeApp.app

hit the return key and codesign should add a "_CodeSignature" folder (and other files) into the package contents of your standalone.

9. Run Product Builder "productbuild" in Terminal

productbuild is one long command with three parts; component, sign, and product. Enter all the parts before you press return.

Type "productbuild --component " (there is a space after "component"). In the Finder drag the standalone application file into Terminal and Terminal will enter the absolute path to it. Enter "/Applications --sign " followed by an opening quote. Enter the Mac Developer Installer certificate name followed by a closing quote. The image above of the Keychain shows the certificate name for this example that gets entered. Enter " --product " then drag the Info.plist file from your standalone application package contents to the Terminal. Then in quotes enter the name of the package you wish it to create with a ".pkg" suffix. I have read that the package name cannot contain spaces even when placed inside quotes, and it is a useful practice to put the version number in the name so that each standalone revision has a unique package name. With this example, the entire productbuild line in Terminal would look like:

jdough:~ jdough$ productbuild --component /Users/jdough/Documents/MyLiveCodeApp/MyLiveCodeApp/MyLiveCodeApp.app /Applications --sign "3rd Party Mac Developer Installer: J Dough" --product /Users/jdough/Documents/MyLiveCodeApp/MyLiveCodeApp/MyLiveCodeApp.app/Contents/Info.plist "MyLiveCodeApp_1.0.0.pkg"

Press return and the results in Terminal should have four lines that begin like these:

productbuild: Adding component at ...
productbuild: Signing product with identity "3rd Party Mac ...
productbuild: Adding intermediate certificate "Apple ...
productbuild: Wrote product to ...

The package that gets created will be located at the default directory used by Terminal, typically the top level of your user account directory. Search for the file name (in this example "MyLiveCodeApp_1.0.0.pkg") in the Finder to locate it. Feel free to move the .pkg installer package to a more convenient location on your hard drive.

10. Test the installer package.

Create a copy of the installer package and move it to some other location. I suggest moving the copy to the desktop. Edit the file name back to the original name (if you made a copy, remove the " copy" text from the file name).

Remove the standalone so that the installer can replace it. My suggestion is to Compress the standalone and then delete the uncompressed version. Select the standalone in the Finder and in the File menu select the "Compress "MyLiveCodeApp"" menu item. Then leave the resulting zip file and put the original standalone file in the Trash.

In Terminal, enter "sudo installer -store -pkg " (without the quotes) and then drag the copy of the installer package from the desktop into the Terminal. Then enter "-target /" (without the quotes) and press return. You'll be asked for your administrative password. The result should look something like:

jdough:~ jdough$ sudo installer -store -pkg /Users/jdough/Desktop/MyLiveCodeApp_1.0.0.pkg -target /
Password:
installer: MyLiveCodeApp_1.0.0.pkg has valid signature for submission
installer: Installation Check: Passed
installer: Volume Check: Passed
installer: Bundle com.mycompany.mylivecodeapp will be relocated to /Users/jdough/Documents/MyLiveCodeApp/MyLiveCodeApp/MyLiveCodeApp.app
installer: Starting install
installer: Install 0.0% complete
installer: Install 9.1% complete
installer: Install 16.7% complete
installer: Install 23.2% complete
installer: Install 100.0% complete
installer: Finished install
jdough:~ jdough$

The application should be installed within your Applications folder.

Time to log into iTunes Connect available through the Apple Developer site and follow the instructions to upload your application to the App Store.

If your application manipulates documents, be sure to provide the reviewers with sample documents.

Good luck!

 

 

Main Menu

What's New

Get RunRevLive.11 Dvd's