Mac APP packaging issues summary and collation. Submit to Github with a simple configuration:

const now = new Date;
const buildVersion = `${now.getFullYear() - 2020}.${now.getMonth() - 6}.${now.getDate()}`;
const id = 'cn.coding01.fanlycalendar';
/**
 * @type {import('electron-builder').Configuration}
 * @see https://www.electron.build/configuration/configuration
 */
const config = {
  appId: id,
  directories: {
    output: 'dist',
    buildResources: 'buildResources',
  },
  files: [
    'packages/**/dist/**',
  ],
  extraMetadata: {
    version: buildVersion,
  },
  mac: {
    target: 'mas',
    extendInfo: {
      CFBundlePackageType: 'APPL',
      CFBundleIdentifier: id,
      CFBundleShortVersionString: buildVersion,
    },
  },
};

module.exports = config;
Copy the code

The PKG installation package is automatically packaged:

Direct submission to Transporter:

Well, it’s not going to go well.

The ICNS icon is faulty

The first question is about icon. It was made using online tools before, but it probably lacks icon. Later, I found a workflow, which is particularly easy to use and directly integrated into the right-click menu bar:

One key generation, perfect, specific code view: github.com/molcik/PNG-…

The 3rd Party Mac Developer Installer certificate is faulty

The second problem is that we use the Developer ID Application: *** (***) for online packaging. After submitting to the server, we need to reuse the 3rd Party Mac Developer Installer: *** (***) code sign:

Productsign --sign "3rd Party Mac Developer Installer: * * * * * * () ", "/ Users/yemeishu/Downloads/FanlyCalendar - 1.0.23. PKG." " "/ Users/yemeishu/Downloads/FanlyCalendar - 1.0.23 _sign. PKG." "Copy the code

With the above two problems solved, let’s look at the results of the submission:

App – the sandbox

ERROR ITMS-90296: "App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a  Boolean value of true in the entitlements property list: [( "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/FanlyCalendar Helper (GPU).app/Contents/MacOS/FanlyCalendar Helper (GPU)", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/FanlyCalendar Helper (Plugin).app/Contents/MacOS/FanlyCalendar Helper (Plugin)", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/FanlyCalendar Helper (Renderer).app/Contents/MacOS/FanlyCalendar Helper (Renderer)", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/FanlyCalendar Helper.app/Contents/MacOS/FanlyCalendar Helper", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/Shi pIt", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/MacOS/FanlyCalendar", "cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Resources/app.asar.unpacked/node_modules/esbuild/bin/e sbuild" )] Refer to App Sandbox page at https://developer.apple.com/documentation/security/app_sandbox for more information on sandboxing your app."Copy the code

This is mainly using entitlements, configuration:

    <key>com.apple.security.app-sandbox</key>
    <true/>
Copy the code

So we need to introduce Entitlements. Mas.plist:

<? The XML version = "1.0" encoding = "utf-8"? > <! DOCTYPE plist PUBLIC "- / / / / DTD plist Apple / 1.0 / EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > < plist Version = "1.0" > < dict > < key > com. Apple. Security. The app - the sandbox < / key > < true / >, < the key > com. Apple. Security. Application - groups < / key >  <string>***</string> <key>com.apple.security.files.user-selected.read-write</key> <true/> <key>com.apple.security.network.client</key> <true/> </dict> </plist>Copy the code

And entitlements. Mas. Inherit. Plist:

<? The XML version = "1.0" encoding = "utf-8"? > <! DOCTYPE plist PUBLIC "- / / / / DTD plist Apple / 1.0 / EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > < plist Version = "1.0" > < dict > < key > com. Apple. Security. The app - the sandbox < / key > < true / >, < the key > com. Apple. Security. Inherit < / key > < true / > </dict> </plist>Copy the code

After introduction, new problems appear:

Dear Developer,

We identified one or more issues with a recent delivery for your app, "FanlyCalendar" 1.0.23 (1.0.23). Please correct the following issues, then upload again.

ITMS-90238: Invalid Signature - The nested app bundle Mantle at path FanlyCalendar.app/Contents/Frameworks/Mantle.framework has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/Mantle.framework/Versions/A: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

ITMS-90238: Invalid Signature - The nested app bundle ReactiveObjC at path FanlyCalendar.app/Contents/Frameworks/ReactiveObjC.framework has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/ReactiveObjC.framework/Versions/A: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

ITMS-90238: Invalid Signature - The nested app bundle Squirrel at path FanlyCalendar.app/Contents/Frameworks/Squirrel.framework has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/Squirrel.framework/Versions/A: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

ITMS-90238: Invalid Signature - The executable at path FanlyCalendar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

ITMS-90238: Invalid Signature - The executable at path FanlyCalendar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

ITMS-90238: Invalid Signature - The executable at path FanlyCalendar.app/Contents/Resources/app/node_modules/esbuild/bin/esbuild has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Resources/app/node_modules/esbuild/bin/esbuild: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

ITMS-90238: Invalid Signature - The executable at path FanlyCalendar.app/Contents/Resources/app/node_modules/fsevents/fsevents.node has following signing error(s): valid on disk /Volumes/data01/app_data/awf/mz_17116261486138838905dir/mz_4007830068208133740dir/cn.coding01.fanlycalendar.pkg/Payload/FanlyCalendar.app/Contents/Resources/app/node_modules/fsevents/fsevents.node: satisfies its Designated Requirement test-requirement: code failed to satisfy specified code requirement(s) . Refer to the Code Signing and Application Sandboxing Guide at http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/AboutCS/AboutCS.html and Technical Note 2206 at https://developer.apple.com/library/mac/technotes/tn2206/_index.html for more information.

Best regards,

The App Store Team
Copy the code

Code sign problem

Such problems are basically codesign packaging problems. We try to compile them into.app format in the local NPM run compile, and then use CoDesign to conduct codesign for app and all referenced third-party plug-ins:

#! / bin/bash # application name APP = "FanlyCalendar" # APP_PATH application path = "/ * * * / fanlymenu2 / dist/Mac/FanlyCalendar APP" # generate installation package path APP_KEY="3rd Party Mac Developer Application: *** (***)" INSTALLER_KEY="3rd Party Mac Developer Installer: * * * * * * () "# CHILD_PLIST authorization file path =" / * * * / fanlymenu2 / buildResources/entitlements. Mas. Inherit. Plist" PARENT_PLIST="/***/buildResources/entitlements.mas.plist" FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libEGL.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libswiftshader_libGLESv2.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libvk_swiftshader.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Mantle.framework" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/ReactiveObjC.framework" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Squirrel.framework/Versions/A/Resources/ShipIt" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Squirrel.framework" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/Contents/MacOS/$APP Helper" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper (Renderer).app/Contents/MacOS/$APP Helper (Renderer)" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper (Renderer).app/" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper (GPU).app/Contents/MacOS/$APP Helper (GPU)" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper (GPU).app/" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper (Plugin).app/Contents/MacOS/$APP Helper (Plugin)" codesign -s "$APP_KEY" -f --entitlements  "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper (Plugin).app/" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/Resources/app/node_modules/esbuild/bin/esbuild" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/Resources/app/node_modules/fsevents/fsevents.node" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacOS/$APP" codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH" productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"Copy the code

Process effect:

We then use the Transporter to upload our packed FanlyCalendar.pkg while also seeing in the back of the server that we have to build.

If there is no problem, we can supplement the introduction and information and submit it for review:

Mark:

conclusion

Regardless of the review results, at least so far, the first stage of development has been completed, nearly two months of self-study, plus the time after work at night, give yourself 80 points!

To be continued!