Unable to validate app for MacOS (`.pkg`)

I have MacOS app (*.app) which is builded without using Xcode. I am publishing this app at Apple Store and I found first we need to validate an app and then this .pkg will upload to App Store.

I using xcrun tool validate and publish my .pkg package.

https://help.apple.com/app-store-connect/#/devb1c185036

Code Block
xcrun altool --validate-app -t osx -f ./HyperBIM-v0.36.pkg -u <my_email_address> -p <app_specific_password>
2020-11-06 00:43:54.950 altool[2841:122130] * Error: Unable to validate archive './HyperBIM-v0.36.pkg'.
2020-11-06 00:43:54.950 altool[2841:122130] * Error: code -20008 (Unable to validate your application. The Info.plist indicates a Mac app, but submitting an ipa.)


Here the Info.plist file:
Code Block
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>HyperBIM-v0.36</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>hyperbim.icns</string>
<key>CFBundleIdentifier</key>
<string>CreooxAG</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>HyperBIM-v0.36-22517</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.36</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.36-22517</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>FCStd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>freecad-doc.icns</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>HYPcx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>hyperbim-doc.icns</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
</array>
</dict>
</plist>


But while running .pkg using Installer, it works fine. The app successfully installed and works fine.

Could anybody please help me why xcrun tool throwing errors and how to fix it? What is the problem with Info.plist?

Thanks
Why don't you use Code ? Probably you have a very good reason for.

I compared with the info.plist of one of my apps.

I noticed a few differences.
Copyright is empty. Don't know if some text required here, could try.
Code Block
<key>NSHumanReadableCopyright</key> <string></string>

I do not see the NSMainNibFile key, which should be:
Code Block
<key>NSMainNibFile</key>
<string>MainMenu</string>

The BundleIdentifier is not in reversed DNS format, as asked for in doc;
Code Block
<key>CFBundleIdentifier</key> <string>CreooxAG</string>

it must also match the entry in Appstore Connect:

CFBundleIdentifier
A bundle ID uniquely identifies a single app throughout the system. The bundle ID string must contain only alphanumeric characters (A-Z, a-z, and 0-9), hyphens (-), and periods (.). The string should be in reverse-DNS format. Bundle IDs are case sensitive.
The operating system uses the bundle ID to identify the app for which a given preference applies. Similarly, Launch Services uses the bundle ID to locate an app capable of opening a particular file. The bundle ID also validates an app’s signature.
Important
The bundle ID in the Information Property List must match the bundle ID you enter in App Store Connect. After you upload a build to App Store Connect, you can’t change the bundle ID or delete the associated explicit App ID in your developer account.


I compared with the info.plist of one of my apps.
I noticed a few differences.
Copyright is empty. Don't know if some text required here, could try.
Code Block
<key>NSHumanReadableCopyright</key> <string></string>

Yes, it can be empty.

I do not see the NSMainNibFile key, which should be:
Code Block
<key>NSMainNibFile</key> <string>MainMenu</string>
The BundleIdentifier is not in reversed DNS format, as asked for in doc; 
Code Block
<key>CFBundleIdentifier</key> <string>CreooxAG</string>

After adding NSMainNibFile and changing CFBundleIdentifier from CreooxAG to com.hyperbim it still showing same error.

Code Block
xcrun altool --validate-app -t osx -f ./HyperBIM-v0.36-Signed.pkg -u <email_id> -p <app-specific-password>
2020-11-10 18:47:02.822 altool[21639:1114872] * Error: Unable to validate archive './HyperBIM-v0.36-Signed.pkg'.
2020-11-10 18:47:02.822 altool[21639:1114872] * Error: code -20008 (Unable to validate your application. The Info.plist indicates a Mac app, but submitting an ipa.)


Here is how my Info.plist look like after these updates:

Code Block
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>HyperBIM-v0.36</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>hyperbim.icns</string>
<key>CFBundleIdentifier</key>
<string>com.hyperbim</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>HyperBIM-v0.36-22517</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.36</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.36-22517</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>FCStd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>freecad-doc.icns</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>HYPcx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>hyperbim-doc.icns</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
</array>
</dict>
</plist>

After adding CFBundleSupportedPlatforms key, error Error: code -20008 (Unable to validate your application. The Info.plist indicates a Mac app, but submitting an ipa. is disappeared

Updated Info.plistfile:
Code Block
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>HyperBIM-v0.36</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>hyperbim.icns</string>
<key>CFBundleIdentifier</key>
<string>com.hyperbim</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>HyperBIM-v0.36-22517</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.36</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.36-22517</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>FCStd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>freecad-doc.icns</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>HYPcx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>hyperbim-doc.icns</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
</array>
</dict>
</plist>


But now on validating app, it throwing list of below errors:

Code Block
xcrun altool --validate-app -t osx -f ./HyperBIM-v0.36-Signed.pkg -u <email-id> -p <app-specific-password>
2020-11-10 19:28:05.951 altool[22639:1150229] * Error: Unable to validate archive './HyperBIM-v0.36-Signed.pkg'.
2020-11-10 19:28:05.951 altool[22639:1150229] * Error: code 1091 (App Store operation failed. This bundle is invalid. Product archive "./HyperBIM-v0.36-Signed.pkg" could not be expanded (The operation couldn’t be completed. cpio read error: bad file format).)
2020-11-10 19:28:05.951 altool[22639:1150229] * Error: code 1091 (App Store operation failed. The product archive is invalid. An installer package containing an application bundle was not found in the archive.)
2020-11-10 19:28:05.951 altool[22639:1150229] * Error: code 1091 (App Store operation failed. Invalid product archive metadata. Error in keyPath [product-metadata.product-identifier]. Please re-build your archive with an up-to-date version of Xcode, and submit again.)
2020-11-10 19:28:05.951 altool[22639:1150229] *** Error: code 1091 (App Store operation failed. Invalid product archive metadata. Error in keyPath [product-metadata.product-version]. Please re-build your archive with an up-to-date version of Xcode, and submit again.)

Unable to validate app for MacOS (`.pkg`)
 
 
Q