How to Codesign Growl.framework for Sandboxed Mac

2019-06-28 07:38发布

问题:

I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error:

Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl.framework/Versions/A
./Growl.framework/Versions/A: replacing existing signature
./Growl.framework/Versions/A: object file format unrecognized, invalid, or unsuitable

I've tried re-downloading the framework, but with no luck. Anybody see what I'm doing wrong?

回答1:

Really strange, I've managed to resign the framework like this:

codesign -fs "3rd Party Mac Developer Application: Future Simple" Growl.framework/Versions/A/Growl
Growl.framework/Versions/A/Growl: replacing existing signature

(BTW: I'm working with Xcode 4.3.1 and Growl 1.3.1)



回答2:

I just spent the day working through the "bundle format unrecognized, invalid, or unsuitable" error when codesigning a framework. In my case I'm using XCode 4.6.1 and I was trying to code sign Qt frameworks.

First note that the Apple documentation (TN2206) explicitly states that you need to code sign the versioned framework directory, not the library executable.

This is discussed further here: How do you codesign framework bundles for the Mac App Store?

So, based on that, the command line in Ash's original question is correct. However I was getting the same error.

I did get it working with that command line. Here are the things that I had to do:

  • Make sure that you're using the correct version of CODESIGN_ALLOCATE. This is discussed in many of the answers here: iPhone Codesign object file format invalid or unsuitable If you can get XCode to sign an app then you can find the CODESIGN_ALLOCATE path in the build log.

  • Make sure that the versioned directory (./Growl.framework/Versions/A in the question above) contains Resources/Info.plist and that there is a link from Versions/Current -> Versions/A and that there is a link Resources -> Versions/Current/Resources at the top level of the framework bundle. I found that I could not sign the versioned framework directory without the Versions/A/Resources/Info.plist being present. You can read more about the correct structure of a framework here and here, or just take a look at some system frameworks to get an understanding about how they're supposed to be structured.

  • Further to the previous point, make sure that your symlinks in your framework bundle are structured correctly (Current links to numbered version, top level links to Current) as shown in the Apple docs. This won't affect code signing but your App will be rejected if you don't get this right.

  • Make sure that CFBundleExecutable is set to the correct name (the executable name) in your framework's Info.plist



回答3:

Would it be better if we shipped the sdk unsigned? It'd be a simple change, I'm hesitant to do so now since it's been like this for a little while.



回答4:

It looks like the error might have been trying to sign a bundle that was already signed; I fixed the issue by downloading the Growl framework source and compiling it with my own signature instead.

If I find a better answer that will work for frameworks for which you don't have the ability to compile, I'll post it here.