Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4.1 Code Signing Issue

I've read through many threads and can't find anything like my issue here. I think that this is a simple fix, but I just can't seem to find the answer. I'm using Xcode 4.1 Gold Master.

Basically, when I archive my Mac app, it goes through all the normal processes. The build is successful. However, when I submit to the app store, I get the following message back:

Invalid Code Signing Entitlements - Your application bundle's signature contains code 
signing entitlements that are not supported on Mac OS X; this may happen if your Mac OS X 
project was ported from iOS. Please check your Xcode project's code signing entitlements 
configuration, and remove any unneeded entitlements.

Specifically, key "application-identifier" in "My App" is not supported.

My app was not ported from iOS and I have never setup entitlements. After many hours of digging, I found that the code sign phase was generating an .xcent file in this format:

<?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>application-identifier</key>
    <string>My.App.Identifier</string>
    <key>com.apple.application-identifier</key>
    <string>My.App.Identifier</string>
</dict>
</plist>

The first key is the one causing the problem. When I remove that and force resign the app with the same .xcent file through the command line, then the app goes through.

I've removed and reinstalled xcode to see if that helps...it doesn't.

I know this file creation is tied to the provisioning profile. It seems to be getting the right data, but adding that existing tag. I've checked both the project and build settings and there are no code signing entitlements at all. Any idea how I can get Xcode to stop generating this key? I'm not really fond of doing this every time I want to submit to the app store.

like image 261
Scott Harwell Avatar asked Jul 13 '11 14:07

Scott Harwell


People also ask

How can I skip code signing for development builds in Xcode?

In Xcode 10, you can choose “Other…” and set the text to empty to disable code signing.

How do I disable code signing during the build process OSX?

To disable Code Signing when building for macOS leave all the above vars unset except for CSC_IDENTITY_AUTO_DISCOVERY which needs to be set to false . This can be done by running export CSC_IDENTITY_AUTO_DISCOVERY=false .

What is code signing Xcode?

Code signing your app assures users that it's from a known source and hasn't been modified since it was last signed. Before your app can integrate app services, be installed on a device, or be submitted to the App Store, it must be signed with a certificate issued by Apple.

What is Codesign Mac?

You use the codesign command to interrogate an app or other signed entity about its signature. To verify the signature on a signed binary, use the -v option with no other options: codesign -v <code-path>


1 Answers

I face the same problem. After reading your message I investigated a little bit.

It looks like during the building process the .xcent file is generated from the file located at /Developer/Platforms/MacOSX.platform/Entitlements.plist (it may also be located in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Entitlements.plist).

I edited this file and replaced "application-identifier" by "com.apple.application-identifier". So now the .xcent file contains only:

<?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>com.apple.application-identifier</key>
    <string>33R9UFHX3C.com.mycompany.myapp</string>
</dict>
</plist>

However I still face a invalid binary error when I build and upload it.

EDIT: it actually works. (I had another non-related issue)

like image 60
Thomas Avatar answered Oct 19 '22 15:10

Thomas