Invalid signature when submitting on Mac App Store

Hello everyone,

I’m developing a game for Mac App Store from Unity in which I have a plugin created in Xcode as .bundle file. I am able to codesign and package my game via terminal but problem appears when I try to submit package via Application Loader. I will try to explain everything thoroughly:

Package gets uploaded on iTunes Connect but at the end I get following warning:

WARNING ITMS-90239: “Invalid
Signature. A sealed resource is
missing or invalid. The binary at path
[Panda Commander Air
Combat.app/Contents/Plugins/InAppPurchase.bundle/Contents/MacOS/InAppPurchase]
contains an invalid signature. Make
sure you have signed your application
with a distribution certificate, not
an ad hoc certificate or a development
certificate. Verify that the code
signing settings in Xcode are correct
at the target level (which override
any values at the project level). If
you are certain your code signing
settings are correct, choose “Clean
All” in Xcode, delete the “build”
directory in the Finder, and rebuild
your release target.”

I can click on “Next” and finish my submit, but this warning must be resolved because I get mail from iTunes Connect with issues that must be corrected:

UNABLE TO SIGN - This package doesn’t
meet the current code signing
requirements. For more information,
see the Code Signing and Application
Sandboxing Guide [1] and Technical
Note 2206 [2].

Specifically, codesign generated the
following error:

webelinx.appstore.panda.pkg/Payload/Panda
Commander Air
Combat.app/Contents/Plugins/InAppPurchase.bundle:
unsealed contents present in the
bundle root

Once these issues have been
corrected, you can then redeliver the
corrected binary.

[1]
Documentation Archive
[2]
Technical Note TN2206: macOS Code Signing In Depth

My plugin actually IS signed in Xcode, I’ve created new bundle ID and distribution provisioning profile for Mac App Store specifically for this plugin and setup everything in Code Signing tab. Code signing identity is 3rd Party Mac Developer Application and appropriate provisioning profile is selected. When I build this bundle it asks me to allow codesigning, and afterwards when I check it with “codesign -dvvv” command in terminal I can see codesign details. If I don’t codesign it, I get another warning when I upload my package which says that bundle is not signed at all. I even tried to do a “Clean all”, delete “build” directory and rebuild bundle as suggested in warning, but it has no effect, warning appears again.

How can resolve this warning? Am I missing something important or trying to fix things in wrong way?
Any help will be appreciated because I am out of options at the moment.

Thanks in advance!

OK, I solved my problem. I was missing few things and I found solution here: http://forum.unity3d.com/threads/signing-mac-app-on-os-x-mavericks.206762/.
The thing I still had to do was to manually codesign every file in Contents/Frameworks and Contents/Plugins directories inside .app file and to delete all .meta files inside my plugin. After I did these steps, I codesigned once more whole .app file and created a package which I uploaded on iTunes Connect without warning mentioned above.