Skip to main content
DMcQ
Known Participant
May 9, 2014
Answered

Tutorial on publishing Flex/Air app for Mac App Store or just using Developer ID for general distribution

  • May 9, 2014
  • 8 replies
  • 24494 views

Has anybody put together a tutorial on publishing a Flex/AIR application for distribution as an OSX desktop app, either through Mac App Store or just using the Developer ID certificate?

In my time as a Flex developer, I've seen some things documented well and some that you had to dig for, but finding clear instructions on this is really difficult! I would have thought publishing your Flex/AIR app as a stand-alone (captive runtime) application either through the Mac App Store or to users directly (signing with an Apple Developer ID certificate) would be something many people are trying to do. But most of the helpful posts out there are dated or incomplete as well as being specifically targeted towards iOS. Furthermore, each time the AIR SDK changes it seems many of the past posts are no longer valid at some step.

Big thanks for anybody who can provide pointers or suggestions!

This topic has been closed for replies.
Correct answer re-cycle

Since Harman will be taking over the support and development of the AIR platform I've shot them an email explaining the problem and referencing this thread. (Adobe.Support@harman.com) / Harman - Adobe Partnership - HARMAN


I have it working!!!   Woooohoooo!

DHL83​'s correspondence with Apple and reference to the Electron thread on Apple's Developer support site provided me with some ideas for googling whether entitlements could be added for apps produced by 3rd party tools such as the Flex SDK.  After a lot of trial-and-error, I worked out what entitlements are required.

Here are the steps in addition to the signing script I posted above:

1. You need to create an Entitlements file which will look like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>com.apple.security.cs.allow-jit</key>

<true/>

<key>com.apple.security.cs.allow-unsigned-executable-memory</key>

<true/>

</dict>

</plist>

Thismust be created in XCode otherwise get an error about blobs not being correct:

HomeDirXCodePropertyList.plist: unrecognized blob type (accepting blindly)
HomeDirXCodePropertyList.plist: invalid length in entitlement blob

To create in XCode, do this:

In XCode, File->New->File...
Choose MacOS tab -> Resource -> Property List
Right click on the document -> Property List Type -> Entitlements File
Add Row using + button.

Select Allow Execution of JIT-compiled code and select Boolean value YES

Add Row using + button

Select Allow Unsigned Executable Memory and select Boolean value YES

Save the file (I called it entitlements.plist) and reference it in the .app signing line.

2. Change the script you use for signing the .app to reference this file:

codesign  --force --options runtime --deep --sign  "Developer ID Application: My Company, Inc (AB1CD2E3FG)" --entitlements "/Users/username/Documents/entitlements.plist" "/Users/username/Documents/out/MyApp.app"

Check that you don't get any errors from the entitlements file.

3. Use product build in the script as before (no changes) to create the .pkg

4. As before, submit the app for Notarization, then staple once it completes successfully.

My testing has been as follows:

1. Delete the .app files from my machine.

2. Upload the .pkg file to a web server.

3. Download it and install on 10.14.5 Mojave.

It installs and runs without the previous codesign error.  Hope it works for others!

8 replies

KR-san
Inspiring
December 13, 2019

Hi. Has anyone succeeded in notarization using macOS 10.15 Catalina?

Doing the same, mojave succeeds but catalina fails.

When the app signature is confirmed with the spctl command, it is rejected.

spctl command displays "source=no usualble signature"

Inspiring
December 13, 2019

Hi KR-san, yes I have successfully notarized my Mac app in 10.15 -- did you see my post directly above your's (https://community.adobe.com/t5/air/tutorial-on-publishing-flex-air-app-for-mac-app-store-or-just-using-developer-id-for-general/m-p/10799413#M55893)? I documented all the steps and results. I was helping someone else who told me that the latest Harman build solved the symbolic linking thing I experienced, but try following my notes and let me know where yours gets different results.

 

-jonathan

Legend
January 28, 2020

Here is what I am using.

I have created both notarized Developer Id and App Store apps using the bash scripts provided.

https://github.com/tuarua/WebViewANE/tree/development/example-desktop-complete/mac_packaging

Inspiring
September 29, 2019

I just went through the process on Mac OSX 10.14.6, and the posts in this thread helped me a lot to get my app properly signed and notarized. The main obstacle that I did not resolve from these posts was correcting the symlinks in the app generated by adt. I had to manually go in and correct the linkages.

 

To help others who may be going through this, I detailed my whole experience from adt'ing through notarizing. This post is quite long, but it is kind of what I wish I could have seen in trying to fix my issues. I hope it is helpful to someone out there. If you have questions, ping me and I'll try to help (you'll see I'm no expert on bash scripts).

 

-jonathan

 

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

 

My Steps for Building AIR app on Mac OS 10.14.6

I have been publishing my Flash/AIR app (called SimsUshare_v2) to Mac OSX since 2012. Recently, however, Apple required that the app not only be code signed, but also notarized, since in some upcoming release of Mac OS, they will require all apps to be notarized.

I basically followed the steps I found in other articles, but they didn’t quite get me there. Here are three central articles I used:

  1. Notarizing the app, very useful: “How to notarize your software on macOS
  2. Codesigning and notarizing Mac AIR apps, specifically: “Tutorial on publishing Flex/Air app for Mac App Store or just using Developer ID for general distribution”, particularly the post marked “Correct Answer” by re-cycle. Of course the success is due to several people who helped him or her, but it’s easiest to identify the last person who put it all together.
  3. Codesigning and notarizing in general: “How to codesign and notarise your app for macOS 10.14 and higher

In this post I will detail all the steps I used to get my app successfully codesigned and notarized. I am not going to go into how I got the certificates from my developer account, that should be clear from other places. I went into the process with my private key (myCertificate.p12), my password, and the latest AIR 32 build (as of September, 2019).

Compiling the App

I use adt to build the captive runtime as follows:

../AdobeAIRSDK/AdobeAIRSDK-32/bin/adt -package -storetype pkcs12 -keystore myCertificate.p12 -tsa http://sha256timestamp.ws.symantec.com/sha256/timestamp -target bundle "SimsUshare_v2.app" SUSFreeWinMac-app.xml -C . SUSFreeWinMac.swf libs/ examples/ icons/ piccache/ assets/

I am prompted for my certificate password, which I entered. This builds the SimsUshare_v2.app in the same folder.

The Start of Codesign woes

The original codesign statement I used to use did not have the parameters that were needed now to codesign and notarize the app, namely stuff about the hardened runtime.

codesign -f -v --options runtime -s "Developer ID Application: Equipment Simulations LLC" --entitlements "$APP_DIR/entitlements.plist" "$APP_DIR/SimsUshare_v2.app"

You’ll see from this statement I also added an entitlements.plist file which was suggested by the #2 article above (re-cycle). I am including that file with this post so you can see it directly. I did not try the build after getting it working to see if I truly need the entitlements.plist file, though. BTW, the $APP_DIR is from my build (bash) script (below) and merely points to the folder in which I have the app.

When I tried to follow the steps in article #2 after making my build script, I kept getting this error from codesign

SimsUshare_v2.app: bundle format is ambiguous (could be app or framework)

In subcomponent: /Users/jonathankaye/Dropbox/SimsUshare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework

After reviewing a lot of the posts in the article #2 from above, I saw I had to remove certain parts of the app (like WebKit) and codesign the pieces directly. I was trying to do it once with the codesign --deep parameter. However, Apple’s codesigning documentation (which actually was useful, albeit very long) said that it is best to sign each part individually rather than to rely on --deep. This documentation also clued me into the real culprit, because it mentions “symlinks” under the error for ambiguous bundle format.

The symlink mention reminded me I had seen this post and comment from Juergen saying to examine the symlinks and the application needs to be in a certain structure. Honestly I didn’t quote understand what that structure was from Juergen’s comment, but I was able to find this somewhere else based on Dass’ comment that made it clearer:

I used this example to clean up the SimsUshare_v2.app structure to have the correct symlinks, which I then put into my codesign script, below. FWIW, here is my diagram of the app (‘…’ is whatever is in there, -> are symlinks):

Adobe AIR.framework/

ADOBE AIR  ->     Versions/Current/ADOBE AIR

ADOBE AIR_64 ->     Versions/Current/ADOBE AIR_64

Resources  ->     Versions/Current/Resources

Versions/

     1.0/

           ADOBE AIR …

           ADOBE AIR_64 …

           Resources …

     Current    -> 1.0

Structure of AIR app under SimsUshare_v2.app/Contents/Frameworks

 

To make these changes, I added the fixes to my script for codesigning (I did hardcode the 2.8.6 into the APP_DIR variable which I will replace with VERSION at some later time, also I could make the script with a parameter for VERSION to make it more general).

You will see in the script that in addition to the symlink fixing, I also added some a command I had found to remove extended attributes (which Apple labels as “detritus”, if you don’t do that step), and I also put in checks to see that the app, once codesigned, passes two tests – one to verify the codesign, and the second to see if Gatekeeper will accept it. Of course I removed my passwords from the script, for posting. At the bottom of the script I put the complete output I received.

You’ll see I commented out a line (line 11) about copying icons, I did not have a problem with icons AFAIK but that copy statement was from a different article that had problems with AIR 31 and icons.

#!/usr/bin/env bash

 

VERSION="2.8.6"

APP_DIR="/Users/jonathankaye/Dropbox/SimsUShare Mac Stuff/SimsUshare 2.8.6"

 

INFO_PLIST="$APP_DIR/SimsUshare_v2.app/Contents/Info.plist"

 

cd "$APP_DIR"

 

# copy icons file over -- the one built by AIR which is still packaged incorrectly as of AIR SDK 31

# cp -f ./packaging/Icon.icns ./SimsUshare_v2.app/Contents/Resources/Icon.icns

 

printf "\n++++ Fix the symlinks manually\n"

cd "SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework"

rm "Adobe AIR"

ln -s Versions/Current/Adobe\ AIR "Adobe AIR"

ln -s Versions/Current/Adobe\ AIR_64 "Adobe AIR_64"

rm -fr Resources/

ln -s Versions/Current/Resources Resources

cd Versions

rm -fr Current

ln -s 1.0 Current

 

cd "$APP_DIR"

 

printf "\n>>>> removing stuff that would cause problems\n"

rm -f "./SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/WebKit.dylib"

rm -f "./SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/Adobe AIR.vch"

rm -fr "./SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/__MACOSX"

 

printf "\n>>>> removing extended resources (Apple calls it detritus)\n"

xattr -cr SimsUshare_v2.app

 

printf "\n>>>> updating the info.plist\n"

/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString \"${VERSION}\"" "${INFO_PLIST}"

/usr/libexec/PlistBuddy -c "Set :CFBundleGetInfoString \"${VERSION}, © 2019 Equipment Simulations LLC. All rights reserved.\"" "${INFO_PLIST}"

/usr/libexec/PlistBuddy -c "Add :LSApplicationCategoryType string public.app-category.business" "${INFO_PLIST}"

 

codesign -f -v -s "Developer ID Application: Equipment Simulations LLC" "$APP_DIR/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0"

codesign -f -v -s "Developer ID Application: Equipment Simulations LLC" "$APP_DIR/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR"

codesign -f -v -s "Developer ID Application: Equipment Simulations LLC" "$APP_DIR/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR_64"

 

printf "\n>>>> code sign Frameworks/Adobe AIR.framework\n"

codesign -f -v -s "Developer ID Application: Equipment Simulations LLC" "$APP_DIR/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework"

 

printf "\n>>>> code signing the app\n"

codesign -f -v --options runtime -s "Developer ID Application: Equipment Simulations LLC" --entitlements "$APP_DIR/entitlements.plist" "$APP_DIR/SimsUshare_v2.app"

 

printf "\n+++ Check to see if signed properly\n"

codesign --verify --verbose=4 SimsUshare_v2.app

 

printf "\n+++ Check if app passes Gatekeeper test\n"

spctl -a -t exec -vv SimsUshare_v2.app/

 

: '

#################################################

############    EXPECTED OUTPUT      ############

#################################################

Jonathans-Mini:SimsUshare 2.8.6 jonathankaye$ ./build.sh

 

>>>> removing stuff that would cause problems

>>>> removing extended resources (Apple calls it detritus)

>>>> updating the info.plist/Users/jonathankaye/Dropbox/SimsUShare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0: code object is not signed at all

In subcomponent: /Users/jonathankaye/Dropbox/SimsUshare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR_64

/Users/jonathankaye/Dropbox/SimsUShare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR: code object is not signed at all

In subcomponent: /Users/jonathankaye/Dropbox/SimsUshare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR_64

/Users/jonathankaye/Dropbox/SimsUShare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR_64: signed Mach-O thin (x86_64) [Adobe AIR_64]

 

>>>> code sign Frameworks/Adobe AIR.framework/Users/jonathankaye/Dropbox/SimsUShare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework: signed bundle with Mach-O thin (x86_64) [com.adobe.AIR]

 

>>>> code signing the app/Users/jonathankaye/Dropbox/SimsUShare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app: signed app bundle with Mach-O thin (x86_64) [com.simsushare.desktop.free]

 

+++ Check to see if signed properly--prepared:/Users/jonathankaye/Dropbox/SimsUshare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/Current/.

--validated:/Users/jonathankaye/Dropbox/SimsUshare Mac Stuff/SimsUshare 2.8.6/SimsUshare_v2.app/Contents/Frameworks/Adobe AIR.framework/Versions/Current/.

SimsUshare_v2.app: valid on disk

SimsUshare_v2.app: satisfies its Designated Requirement

 

+++ Check if app passes Gatekeeper testSimsUshare_v2.app/:

accepted

source=Developer ID

origin=Developer ID Application: Equipment Simulations LLC (8AXD232TA7)

Jonathans-Mini:SimsUshare 2.8.6 jonathankaye$

'

 

From the last few lines you can see my app was now properly codesigned and it passes Gatekeeper’s test. On to the notarization!

For this, I followed article #1 that I had listed at the top. That article was very clear, so here are my instructions that made it work:

  1. I made a DMG using DropDMG, which is a great app, BTW, for making DMG’s really simply. Well worth the cost!
  2. Now I had to upload the DMG to Apple’s servers:

xcrun altool --type osx --file SimsUshare_v2.dmg --primary-bundle-id com.simsushare.SUSMobileDesktop --notarize-app --username u@eqsim.com

  1. Before doing this, I had to go through the Developer portal to create an app-specific password, which I was prompted for, and entered.
  2. I received the following response after 5 minutes (of course I blanked out the actual UUID [the notarize ID] received):

 

No errors uploading 'SimsUshare_v2.dmg'.

RequestUUID = 1xxxxxxxx-xxxx-xxxxx-xxxx-xxxxx1f1

 

  1. I put the notarize ID into the next command:

 

xcrun altool --notarization-info 1xxxxxxxx-xxxx-xxxxx-xxxx-xxxxx1f1 --username u@eqsim.com

 

  1. After it asked for the app-specific password, I received (I removed my password below!)

No errors getting notarization info.

Date: 2019-09-25 13:43:51 +0000

       Hash: bd86076feaxxxxxxxxxxxxxxxxxxx5ac2bc631bc7

RequestUUID: 1xxxxxxxx-xxxx-xxxxx-xxxx-xxxxx1f1

     Status: in progress

 

To query the status (from https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution/customizing_the_notarization_workflow#3087720😞

xcrun altool --notarization-info 1xxxxxxxx-xxxx-xxxxx-xxxx-xxxxx1f1 -u u@eqsim.com -p <my password!> --output-format xml

  1. I did check the status using the command it stated, but about 4-5 minutes later, I checked it and received the approval notice, like this:

xcrun altool --notarization-info 1xxxxxxxx-xxxx-xxxxx-xxxx-xxxxx1f1 -u u@eqsim.com -p <my password!> --output-format xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

     <key>notarization-info</key>

     <dict>

           <key>Date</key>

           <date>2019-09-25T13:43:51Z</date>

           <key>Hash</key>

           <string>bd86076feaxxxxxxxxxxxxxxxxxxx5ac2bc631bc7</string>

           <key>LogFileURL</key>

           <string>https://osxapps-ssl.itunes.apple.com/itunes-assets/Enigma123/v4/0e/48/4f/0e484f28-9919-3c8c-f0d1-045e2cee3b80/developer_log.json?accessKey=1569613711%3D</string>

           <key>RequestUUID</key>

           <string>xxxxxxxxxxxxxxxxxxxxx</string>

           <key>Status</key>

           <string>success</string>

           <key>Status Code</key>

           <integer>0</integer>

           <key>Status Message</key>

           <string>Package Approved</string>

     </dict>

     <key>os-version</key>

     <string>10.14.6</string>

     <key>success-message</key>

     <string>No errors getting notarization info.</string>

     <key>tool-path</key>

     <string>/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework</string>

     <key>tool-version</key>

     <string>4.00.1181</string>

</dict>

</plist>

 

  1. Yay! Last step was to staple the output, or something:

xcrun stapler staple -v SimsUshare_v2.dmg

  1. Which after a little bit came back with a long response that ended with

The staple and validate action worked!

 

  1. As the article #1 I mentioned says: Congratulations ... your app has now been codesigned and notarized
  2. After you installed the app (from the .dmg) you can double check if everything is working:

 

spctl -a -v </Path/to/your.app>

 

  1. After your app has been successfully notarized, you will also receive a mail from Apple:

 

Dear Sir,

Your Mac software (bundle identifier ) has been notarized. You can now export this software and distribute it directly to users.

For details on exporting a notarized app, visit Xcode Help.

Best Regards,

Apple Developer Relations

 

Known Participant
September 30, 2019
Thank you for the tip about DropDMG @JonathanKaye19147! I ended up purchasing it and I am now using it to build my .dmgs
ejthomas95746
Participating Frequently
November 8, 2018

Just in case anyone still has trouble with this for hosting your installer other than on the Mac App Store, here is my bash script that creates a .pkg installer for MacOS and it downloads without any warnings from any browser (tested with Safari, Chrome, Firefox and Brave), and it installs without warnings, and the installed app launches without warnings.

It also fixes the icons that as of AIR 31 are still wrong for MacOS, and it updates Info.plist with version. This app package contains 10 ANEs as well.

# !/bin/bash

VERSION=$1

USAGE="Usage: build.sh app_version_string (n.n.n)"

if [ "$VERSION" == "" ]; then

    echo "app_version_string is required"

    echo ${USAGE}

    exit 1

fi

INFO_PLIST="$APP_DIR/out/your-app.app/Contents/Info.plist"

cd $APP_DIR

# copy icons file over the one built by AIR which is still packaged incorrectly as of AIR SDK 31

cp -f ./packaging/Icon.icns ./out/your-app.app/Contents/Resources/Icon.icns

rm -f "./out/your-app.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/WebKit.dylib"

rm -f "./out/your-app.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/Adobe AIR.vch"

/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" "${INFO_PLIST}"

/usr/libexec/PlistBuddy -c "Set :CFBundleGetInfoString ${VERSION}, © 2018 Your Company, Inc. All rights reserved." "${INFO_PLIST}"

/usr/libexec/PlistBuddy -c "Add :LSApplicationCategoryType string public.app-category.business " "${INFO_PLIST}"

codesign -f -v -s "Developer ID Application: Your Company, Inc. (YOUR_TEAM_ID)" "./out/your-app.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR_64"

codesign -f -v -s "Developer ID Application: Your Company, Inc. (YOUR_TEAM_ID)" "./out/your-app.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Adobe AIR"

codesign -f -v -s "Developer ID Application: Your Company, Inc. (YOUR_TEAM_ID)" "./out/your-app.app/Contents/Frameworks/Adobe AIR.framework"

codesign -f -v -s "Developer ID Application: Your Company, Inc. (YOUR_TEAM_ID)" "./out/your-app.app"

productbuild --component ./out/your-app.app /Applications "./packaging/mac/your-app.pkg"  --sign "Developer ID Installer: Your Company, Inc. (YOUR_TEAM_ID)" --identifier "your-app" --version "${VERSION}"

Participating Frequently
June 28, 2019

Huge thanks to everyone for contributions to this thread and especially to ejthomas95746​ for providing the script.

A few extra pointers for anyone doing this process:

1. As of AIR 31 or 32, there is an additional file to sign which is Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/A2712Enabler

I'm not sure if it's necessary but it is easy enough to sign.

2. For future-proofing, Apple now likes all apps to be Notarized (and will require it for all apps from MacOS 10.15).  Details of how to do it are here: https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution/customizing_the_notarization_workflow#3087734

For this to happen and for it not to fail, it's necessary to sign the A2712Enabler file and your MyApp.app file in a different way so that it includes a 'hardened runtime'.  The updated codesign commands are

codesign  --force --options runtime --deep --sign "Developer ID Application: Your Company, Inc. (YOUR_TEAM_ID)" "./out/your-app.app/Contents/Frameworks/Adobe AIR.framework/Versions/1.0/Resources/A2712Enabler""

codesign  --force --options runtime --deep --sign "Developer ID Application: Your Company, Inc. (YOUR_TEAM_ID)" "./out/your-app.app"

Notarization is then performed as per the document linked above.  You have to create an App-specific password on your iTunes Connect account to do that.

The document also contains details of how to find errors which is very important if the process fails.

3. Finally, you staple the notarization to the app, although there's no reference required, just this command:

xcrun stapler staple "./packaging/mac/your-app.pkg"

4. One other note: It's quite acceptable to use the .air file built and signed on a Windows dev machine as the input to 'adt -package -target bundle' to create the MacOS Captive Runtime version (this saves us time in our build process).  I also found the app 'iCreate icons' to be a really simple way to generate the .icns file required for Mac from the Windows png icons we already had.

Hope this helps someone as much as everyone's previous answers helped me.  Thanks all!

Known Participant
July 11, 2019

Thanks for this re-cycle​. I'm struggling a bit with the signing part. All actions are successfully completed, but after doing the last signing of the .app, using the --options runtime --deep, the app crashes during startup with a message of "Code Signature Invalid":

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)

Exception Codes:       0x0000000000000032, 0x0000086b6eb84f30

Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

Here are my steps:

1. Export app as "Captive Runtime Bundle (.app)" in IntelliJ IDEA

2. Run the following commands:

rm -f MyAIRApp.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/WebKit.dylib

rm -f MyAIRApp.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/Adobe\ AIR.vch

/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString 2.0.2" /Users/me/Desktop/MyAIRApp.app/Contents/Info.plist

/usr/libexec/PlistBuddy -c "Set :CFBundleGetInfoString 2.0.2, © 2019 MyCompany, Inc. All rights reserved." /Users/me/Desktop/MyAIRApp.app/Contents/Info.plist

/usr/libexec/PlistBuddy -c "Add :LSApplicationCategoryType string public.app-category.business" /Users/me/Desktop/MyAIRApp.app/Contents/Info.plist

codesign -f -v -s "Developer ID Application: MyCompany, Inc" MyAIRApp.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/Current/Adobe\ AIR_64

codesign -f -v -s "Developer ID Application: MyCompany, Inc" MyAIRApp.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/Current/Adobe\ AIR

codesign --force --options runtime --deep --sign "Developer ID Application: MyCompany, Inc" MyAIRApp.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/A2712Enabler

codesign -f -v -s "Developer ID Application: MyCompany, Inc" MyAIRApp.app/Contents/Frameworks/Adobe\ AIR.framework/

codesign --force --options runtime --deep --sign "Developer ID Application: MyCompany, Inc" MyAIRApp.app

After this, if I run the app, I get the error above. I won't get the error if I sign A2712Enabler and MyAIRApp.app without --options runtime, but then notarization fails.

Any clue to why the --options runtime gives this Code Signature Invalid crash/error?

I'm using MacOS 10.14.5 and Adobe AIR 31. Air bundle packaged in IntelliJ 2019.1

Inspiring
November 11, 2016

I am trying to code sign my air for mac app (sdk 23/24) and have researched and found several threads, none of which appear to work. This is for general distribution, not for the Mac Store. I have tried the following:

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/Adobe\ AIR.vch

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/adobecp.plugin

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/adobecp.vch

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/AdobeCP15.plugin

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/WebKit.dylib

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/Flash\ Player.plugin

rm -rf APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/1.0/Resources/AdobeCP15.plugin

which all seems to work, followed by:

codesign -f -v -s “Developer ID Application: Developer" APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/Current/Adobe\ AIR_64\ Helper

codesign -f -v -s “Developer ID Application: Developer" APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/Current/Adobe\ AIR_64

codesign -f -v -s “Developer ID Application: Developer" APP.app/Contents/Frameworks/Adobe\ AIR.framework/Versions/Current/Adobe\ AIR

codesign -f -v -s “Developer ID Application: Developer" APP.app/Contents/MacOS/App

codesign -f -v -s “Developer ID Application: Developer" APP.app

which all seems to work, indicating each step is signed.

If I start the signed App.app directly (double click) it opens and runs no problems. However if I put it into a dmg, take the dmg and put it on a server, download back onto the same computer, mount the dmg and try to run App.app, it says it is damaged and should be put in the trash. I have done this several times.

On the signed App.app, when I run spctl -a App.app, I get: App.app: nested code is modified or invalid.

I have also tried the above without the initial rm commands, leaving the bundle intact prior to signing, and just using the 5 codesign commands - get the same results: nested code is modified or invalid. Note that I first compile the app using a self signed certificate, then apply the above to the resultant app.

Any help appreciated, I must be missing a step somewhere?

Participating Frequently
October 13, 2015

I am having some real annoying issues that I think is related to codesigning. The icon just bounces in the dock, then quits. This is what my os x system tells me.

10/13/15 1:34:29.815 PM CoreServicesUIAgent[18086]: Error -60005 creating authorization

10/13/15 1:34:35.885 PM lsd[441]: LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist

10/13/15 1:35:08.718 PM com.apple.backupd[792]: Bulk setting Spotlight attributes failed.

10/13/15 1:36:26.211 PM lsd[441]: LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist

10/13/15 1:36:26.240 PM CoreServicesUIAgent[18086]: Error -60005 creating authorization

10/13/15 1:36:37.946 PM CoreServicesUIAgent[18086]: Cannot load Interface Builder file '/System/Library/Frameworks/AppKit.framework/Resources/English.lproj/NSAlertPanel.nib'

10/13/15 1:36:37.946 PM com.apple.xpc.launchd[1]: (com.apple.xpc.launchd.oneshot.0x10000016.TrafikteoriLaerer[18110]) Service exited due to signal: Killed: 9

Has anyone experienced this or have an idea what this could be?

Participant
December 11, 2014

Hi, I found this post really helpful and have now finally got my app in the osx app store (Garden Planner ) as well as having a gatekeeper friendly version on my site.

I thought I'd share my steps in case it helps anyone.

first up I create the swf and then create the app on my mac with adt

the adt command looks like this AdobeAIRSDK/bin/adt -package -keystore mycert.p12 -storetype pkcs12 -target bundle gardenPlanner.app gardenPlanner-app.xml gardenPlanner.swf

then to create a version for download from my site that gatekeeper is happy with I just code sign the frameworks

codesign -f -s "Developer ID Application: your name (XXXXXXX64)" "gardenPlanner.app/Contents/Frameworks/Adobe AIR.framework"

then sign the app

codesign -f -s "Developer ID Application: your name (XXXXXXX64)" gardenPlanner.app

then product build

productbuild --component gardenPlanner.app /Applications --sign "Developer ID Installer: your name (XXXXXXX64)" gardenPlanner.pkg

and that seems to work. Note you dont have to change the icons or delete stuff from the framework - its probably good practice to at least put in higher res icons, but you dont have to and I wanted to show the minimal steps.

Participant
February 3, 2015

David, are you creating a captive runtime with ADT?

Participant
February 11, 2015

@FuriousCoder, Yes, Since david doull adt command include -native bundle option to represent the inclusion of AIR captive runtime

stolennickname
Inspiring
September 27, 2014

This is the best post on this issue I could find in the Adobe Forums, kudos DMcQ!

That being said, I concur with the other commenters. There are still way too many loose and outdated suggestions. Adobe sorely needs to step up and produce something comprehensive, something far better and more up-to-date than the Post Adobe AIR app to Mac app store page. AIR developers need two detailed documents with explicit environment/SDK version details:

1) Packaging an OS X Adobe AIR app for independent distribution

2) Packaging an OS X Adobe AIR app for Mac App Store distribution

I am struggling to properly codesign my OS X AIR app for independent distribution and have not yet succeeded in creating an app bundle that passes a clean circa OS X 10.9.5 v2 certificate Gatekeeper test: spctl -a -t exec -vv Foo.app.

This returns one of the following, depending one what approach I take:

- rejected

- nested code is modified or invalid

- a sealed resource is missing or invalid

Just some of the many questions and concerns I have regarding some provided suggestions in this manual re-packaging and codesign process:

- Doesn't removing contents of the bundle after it is built invalidate the included resources and jeopardize subsequent codesigning?

- Performing a brute force chmod -R 777 MyApp.app  seems to set the executable bit on enclosed items willy-nilly which seems counterproductive.

- What exact enclosed items need to be codesigned (directories, plugins, binaries), and in what order?

- What about non-App Store distributed applications that need to rely on WebKit?

- What about sandboxing entitlements?

- If entitlements need to be created, provide examples on typical AIR application entitlements and how to craft the file.

- Should the codesign --preserve-metadata option be used, and if so, with what parameters?

- Doesn't AIR 15 [latest beta] support the large icon sizes in the application descriptor and obviate the need to manually edit the icns file?

DMcQ
DMcQAuthor
Known Participant
September 30, 2014

I wish I could say I got my process to work, but I'm stuck here with the same issues you're seeing, stolennickname. Since I can't figure this out myself, I'm wondering who to turn to. Seems like nobody knows exactly how to make an AIR captive runtime app work on OSX without the GateKeeper silliness.

Couple that with spctl's almost mystic "a sealed resource is missing or invalid" message which makes me want to shout "WHICH?!!" so I can at least start to figure out what's happening.

I'm hoping against hope that somebody comes out with an article or blog post that details exactly what you need to do to take your captive runtime .app and make it run without issues.

Participating Frequently
September 30, 2014

This will either be a lot of repeated info or cryptic (because they are my personal notes), but these are the steps that I use for getting CameraSim to work with OSX Gatekeeper:

  1. Export Mac standalone w temp self-signed certificate (I use Flash Pro CC)
  2. (Optional) Pull out .swf from .app package, secure w secureSWF, and put back in the .app
  3. [Only do this step if you have to create new icons, otherwise just recycle the existing .icns file] Update the .icns file in the .app package. Create icon set w iConvert Icons app purchased on Mac App Store. Use the "Mac OS icns" option. This apparently builds a bundle of icons and the file name indicates what the highest rez is. So for example, MyIcons1024x1024.icns bundles all of the assets together and the highest one is the 1024 x 1024. (Note that Finder won’t show the difference until after a restart, although there is some Terminal kill function that would achieve the same result without a reboot.)
  4. Remove unnecessary DRM files from .app to save a little on file size: Adobe AIR.vch, adobeCP15.plugin
  5. Remove WebKit.dylib from .app as this violates Apple’s terms for some reason.
  6. Remove Flash Player.plugin inside .app (this saves 25MB!!)
  7. Add to Info.plist (inside .app package) (and DON'T use Xcode for this...it messed it up once, so just a use a text editor): <key>LSApplicationCategoryType</key> <string>public.app-category.education</string>
  8. Set permissions to make sure everything is readable: Terminal: chmod -R 777 [path to CameraSim.app]
  9. Code sign the app in Terminal: codesign -f -v -s "Developer ID Application: Tuitive, LLC" [path to CameraSim.app]/Contents/Frameworks/Adobe\ AIR.framework
  10. Code sign the app in Terminal: codesign -f -v -s "Developer ID Application: Tuitive, LLC" [path to CameraSim.app]
  11. TEST the signing of the .app in Terminal: spctl -a [path to CameraSim.app] (no response means it worked, otherwise it will say something is wrong, invalid, etc. NOTE: this passes or fails based on current System Preferences security setting, so make sure this is set to "Mac App Store and identified developers")
  12. Wrap an installer around it using dmgCreator app.
  13. Code sign the installer using Terminal: codesign -f -v -s "Developer ID Application: Tuitive, LLC" [path to CameraSim.dmg]
  14. Test the signing of the .dmg using Terminal: spctl -a [path to CameraSim.dmg] (no response means it worked, otherwise it will say something is wrong, invalid, etc.)
  15. Test the installation by putting on local or public web server, download it, and install it. Make sure Gatekeeper settings are set to “Mac App Store and identified developers"

Hope that helps. Good luck...I feel lucky every time I get through this mess.

jadams602
Inspiring
May 9, 2014

The official doc page on Mac App Store submission was updated just over two months ago given some recent changes needed in recent SDKs:

http://helpx.adobe.com/flash-player/kb/posting-air-app-mac-app.html

It should be current, though I think I see a typo in one of the commandline calls that mentions 'textcodesign' when it should just be 'codesign'

DMcQ
DMcQAuthor
Known Participant
May 9, 2014

Thanks for the link Jeffrey. Good resource, although I wish it had more detail for the slower devs like me not completely familiar with the process of packaging for OSX.


When you publish your .app with captive runtime do you use the same Apple certificate (that you later use with codesign)?

jadams602
Inspiring
May 9, 2014

Yes, you typically would to be safe, though I think technically the process of actually using codesign later again on the commandline (after removing and modifying some .app files) essentially acts as a re-signing of the app and replaces any previous use of certificates you would have done during the publish of the app.