17

I'm really going mad with this problem! I have an app that contains a simple Helper app which manages the login item for the Main app.

When I try to submit the app I get errors related to the provisioning profile and the entitlements. I'm sure that the problem is related with the Helper app because before than I added it the submission worked with no problem.

At the moment the helper app is code signed and is sandboxed as the main app.

The errors are :

  • Invalid provisioning profile. The provisioning profile included in the bundle is invalid

  • Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the one that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile 'com.apple.application-identifier' in 'myapp.app/Contents/Library/LoginItems/helper.app'

  • Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the one that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile 'com.apple.application-identifier' in 'myapp.app/Contents/MacOS/myapp'

MatterGoal
  • 16,038
  • 19
  • 109
  • 186
  • Are you using iCloud storage in your app? – Tim Jun 28 '12 at 20:58
  • But then you shouldn't need a provisioning profile at all? Perhaps there are entries in the 'iCloud Containers' list of your (main/helper) app's target summary settings? – Tim Jun 29 '12 at 08:12
  • I solve this problem by code signing from terminal! I can't really understand. – MatterGoal Jun 29 '12 at 12:40
  • I am getting the same error message when trying to validate our app. I even tried to validate the archives the were submitted successfully before and also got the same error. – roustem Jul 06 '12 at 23:25
  • @roustem check my answer! hope it helps you – MatterGoal Jul 08 '12 at 20:14
  • I had the same problem, I had forgotten to set "3rd Party mac Developer Application" in Code Signing Identity in Project Build Settings. – Codler Oct 04 '12 at 16:57

4 Answers4

20

For anyone else coming across this problem, you don't have to codesign the helper app a second time, just remove the "embedded.provisionprofile" from the helper app in the xarchive and you can submit no problem.

seanalltogether
  • 3,542
  • 3
  • 26
  • 24
  • 4
    This worked for me. Both main and helper app are code signed. Both main and helper app have distribution provisioning profiles with separate bundle IDs. I was initially able to build and archive, but encountered issues passing validation. After archiving, I selected the archive and revealed in Finder. Then, manually remove embedded.provisionprofile from the HELPER app deep inside the archive. Then, back in Xcode, re-validate and submit the cleaned archive. – Craig Otis Feb 20 '13 at 00:34
  • Thanks Sean, you just killed my headache! – Jorge Leandro Perez Jun 19 '13 at 12:51
  • phew! What a life saver ! God's gift , Masha Allah :) – real 19 Apr 08 '14 at 20:10
  • 1
    I followed these steps & submitted the app successfully but got the an email from Apple minutes later : "... Invalid Signature - This error occurs when you have signed your app's installer incorrectly. There are two certs required for this process: the "3rd Party Mac Developer Application" cert and the "3rd Party Mac Developer Installer" cert. When signing your package, you need to ensure that you are using the Installer cert to sign your package. Ensure that you are specifying this cert when submitting your app via the Xcode Organizer or when running productbuild from the command line...." – real 19 Apr 08 '14 at 20:53
7

The only solution that seems to solve this problem was codesign and sandboxing the helper app from Xcode and then:


Re-Codesign the Helper app from terminal

codesign -f -s "3rd Party mac Developer Application:" -i "com.bundle.YOUR.HELPER" --entitlements path/to/helper/entitlements YEOR-HELPER.app



Remove provisioning profile from Helper app, adding a "Run script" into the "Build Phases"

rm"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Library/LoginItems/YOUR-HELPER.app/Contents/embedded.provisionprofile"

With this solution we've correctly submitted our App.

MatterGoal
  • 16,038
  • 19
  • 109
  • 186
  • 1
    How about automatic both? `rm "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Library/LoginItems/YOURHELPER.app/Contents/${EMBEDDED_PROFILE_NAME}"` and `codesign -f -s "${CODE_SIGN_IDENTITY}" -i "com.identifier.YOURHELPER" --entitlements "${SOURCE_ROOT}/Path/To/YOURHELPER.entitlements" "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Library/LoginItems/YOURHELPER.app"` – Douwe Maan Aug 04 '12 at 16:22
  • 1
    Do you have to explicitly codesign the helper app again? My helper app has its own BundleID and I don't have a production provisioning profile for it. Nonetheless I could archive the main app and it passed iTC test (Status changed to "waiting for review"). Maybe it will get rejected during Apple review? :S – zavié Aug 19 '12 at 14:59
  • Thanks so much, you made my day. I'm was struggling with this god damn sign errors all week now. I'd give you +100 if I could :D – Vlad Jan 03 '13 at 15:18
  • I was finally able to resolve this problem by deleting the embedded.provisionprofile file from the helper app by adding the following run script: if [ -f "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/embedded.provisionprofile" ]; then rm "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/embedded.provisionprofile" echo "Removed embedded provisioning profile." else echo "No profile found" fi – real 19 Apr 09 '14 at 04:15
1

I had the 3rd error when I accidentally included some 3rd-party .a files in my target. (They're needed for non-App Store distribution but I'd forgotten to exclude them for the App Store build). The error wasn't too helpful in tracking this down!

Graham Perks
  • 23,007
  • 8
  • 61
  • 83
0

I was finally able to resolve this problem by deleting the embedded.provisionprofile file from the helper app by adding the following run script:

if [ -f "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/embedded.provisionprofile" ];
then
    rm "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/embedded.provisionprofile"
    echo "Removed embedded provisioning profile."
else
    echo "No profile found"
fi
real 19
  • 748
  • 8
  • 32