Search code examples
xcode4archivecode-signingosx-lion

Xcode 4.1 - Archiving app gives me Entitlments.plist error


I am using Xcode 4.1 and MacOSX Lion 10.7. I am trying to archive my Mac app so I can upload my app to iTunes connect but it gives me this error:

ProcessProductPackaging /Developer/Platforms/MacOSX.platform/Entitlements.plist /Users/username/Library/Developer/Xcode/DerivedData/appname/Build/Intermediates/appname.build/Debug/appname.build/appname.xcent cd "/Volumes/Apps/iOS/Mac app store/appname" builtin-productPackagingUtility /Developer/Platforms/MacOSX.platform/Entitlements.plist -entitlements -format xml -o /Users/username/Library/Developer/Xcode/DerivedData/appname/Build/Intermediates/appname.build/Debug/appname.build/appname.xcent

error: error reading property list '/Developer/Platforms/MacOSX.platform/Entitlements.plist' - property list has no object Command builtin-productPackagingUtility failed with exit code 1

This error does not occur if I don't sign the code. I was able to submit my apps properly before upgrading to Xcode 4.1. I can't seem to find any documentation on how to sign an app in xcode 4 and I have no idea what the new Enable entitlements and sandbox does.

When I somehow get it to work, I get this email from iTunes connect with the following error: Invalid Code Signing Entitlements - The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile:

According to the provisioning profile, the bundle contains a key value that is not allowed: "appname" for the key "com.apple.application-identifier" in appname.app/Contents/MacOS/appname

What do I need to do to properly submit my app to iTunes connect?


Solution

  • Turns out, there is an issue with packaging apps if you are using a new Macbook manufactured after June of 2010. To package your app, follow these steps:

    1) Build and Archive

    2) Open the Organizer - Archives, find the new archive.

    3) Right-click the archive "Show in Finder"

    4) Right-click the archive in the finder to "Show Package Contents"

    5) drill down to your app (>Products/Applications/YourApp)

    6) Right-click your app, "Show Package Contents"

    7) Delete the _CodeSignature directory

    8) Edit Info.plist

     a) Change BuildMachineOSBuild to "11A511"
    
     b) Save, close
    

    9) Go back to the Products/Applications/YourApp directory in the finder

    10) Open Keychain Access.app

     a) Find your certificate "3rd Party Mac Developer Application: Your Name"
    
     b) double click to inspect it
    
     c) Copy the full Common Name "3rd Party Mac Developer Application: Your Name"
    

    11) Open a terminal and enter the following:

     codesign -s "<paste your cert common name here>" -fv <drag the archived app from the finder to the terminal window here>
    

    12) verify the output:

     "...path to app...: replacing invalid existing signature"
    
     "...path to app...: signed bundle with Mach-O universal (i386 x86_64)"
    

    13) Close all them windows.

    14) Open the Organizer - Archives in XCode

    15) Validate... yep.

    16) Submit... yay!