Thursday, August 24, 2017

NWJS & Mac App : Signing and Submission to Store

Hi Guys,

I am feeling very relieved and relaxed today. Wanna know WHY???

Finally I am able to sign the nwjs mac app with App store 3rd Party App and Installer certificates and create the package and yippie its on App store. :) :) :)

Lets proceed towards the starting point and follow a path to Successful upload. Here you go.


Pre-requisites for Mac App Store Upload:
  • All Apps must have Sandbox enabled. Yes its mandatory.
  • Bit Code is not supported in Mac Apps. So chill.
  • App must be packaged and submitted using Apple's packaging technology included in xcode or via command line tools.Third party installers are not allowed.
  • Bundle Display name, identifier must be properly set.
  • Provide proper Icon Files.

Mac App Certificates and their Naming Conventions:
  • The name begins with:
    • “Mac Developer” for a Mac Development certificate.
    • “3rd Party Mac Developer Application” for a Mac Submission certificate.
    • “3rd Party Mac Developer Application” for a Mac Submission certificate.
    • “3rd Party Mac Developer Application” for a Mac Submission certificate
  • Both your distribution and developer certificates appear in the My Certificates category in Keychain Access. 
    • The distribution certificates begin with the text “3rd Party Mac Developer” followed by the type of certificate and your team name.
  • Only a team agent or admin can obtain and use Distribution certificates or Developer ID certificates.


Things to Do:

  • In Info.plist of your App 
    • Add a key [if not present] named Application Category and choose its value from list provided.
    • Delete key CFBundleDocumentTypes and its Values

  • Ensure that all the files can be read by Non root users. for this you can run command in terminal
    • $ cd path_to_nwjs.app
    • $ chmod a+rX *
    • $ chmod -R u+rwX,go+rX,go-w *
    • Provide readable permission to app file , Parent and Child plists also that will be served as entitlements while code signing the app.

  • Create Parent and Child Entitlements.





  • Set the Bundle identifier of the NWJS Helper App.

  • Set the Bundle Identifier of the App_mode_loader App.

  • Now Sign the App and create package to be uploaded:
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework/Resources/app_mode_loader.app
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework/Versions/A/Helpers/crashpad_handler
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework/Versions/A/XPCServices/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework/libnode.dylib
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework/libffmpeg.dylib
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Framework.framework/Versions/A/nwjs\ Framework
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Child.plist hello.app/Contents/Version/59.0.3071.115/nwjs\ Helper.app
    • $ codesign -f --deep -s "3rd Party Mac Developer Application : Organization_Name (Team ID)" --entitlements Parent.plist hello.app

  • Create Package:
    • $ Productbuild --component "hello.app" /Applications --sign "3rd Party Mac Developer Installer : Organization_Name (Team ID)" --product "hello.app/Contents/Info.plist" myPackage.pkg

  • Upload this package using Application Loader. Choose the latest one.

You may also face some Errors:

  • The Session status is failed and the error description is "failed to open ssh session. (16)"
    • Open Preferences of Application Loader.
    • Click Advanced
    • Select only DAV and unselect Signiant and Aspera.
  • Resource fork : Finder information or similar ditritus not allowed
    • $ xattr -cr hello.app
  • Malformed framework : Framework must contain symbolic link
    • Choose nwjs version that already has inbuilt support for symlinks.
  • Unsealed contents present in the root directory of an embedded framework.
    • Do not change Info.plist files other that nwjs , nwjs Helper and app_mode_loader.app

Fix the issues and upload again.
Success is here....


Hope you guys find it useful.
Thanks a lot for the view.


:)
:)