Search code examples
ioscontinuous-integrationcrashlyticsxcode-botsxcode-server

Crashlytics: Unable to package source due to error


I am setting up an Xcode Bot to automatically upload and distribute my beta app. I have setup a mac with macOS Server and Xcode activated and am able to build and export an IPA manually just fine. The Xcode Bot I created also archives and exports an IPA with no problem.

However, when I try to run the Crashlytics submit script in the Xcode Bot's post triggers, the uploading fails. But if I save the bot generated IPA and manually call the Crashlytics script via Terminal, it uploads just fine. It seems that only the Xcode Bot fails to submit to Crashlytics.

I have all the correct certificates installed on the server Keychain and everything works fine for manual archive/export both in Xcode and using the Xcode Bot's generated IPA.

Here is the log from Xcode Bot:

2016-11-22 17:15:53.942 submit Crashlytics: Crashlytics.framework/submit 1.3.5 (18)
2016-11-22 17:16:03.125 submit Crashlytics: Unable to package source due to error: Error Domain=CLSIPABuilderErrorDomain Code=-6 "(null)" UserInfo={UnderlyingError=Error Domain=CLSCodeSignerErrorDomain Code=-2 "(null)" UserInfo={arguments=(
    "--sign",
    ACFE8B8E177196BFF1974841752020FE96687508,
    "--all-architectures",
    "--force",
    "--entitlements",
    "/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73/Payload/entitlements.xml",
    "/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73/Payload/Ebates Beta.app"
), environment={
    "CODESIGN_ALLOCATE" = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate";
}, status=1, stderr=ACFE8B8E177196BFF1974841752020FE96687508: no identity found
, command=/usr/bin/codesign, stdout=}, SourcePath=/var/folders/81/5t89fdcn3h3680gh99mgvl7934dkfg/T/com.crashlytics.ipas/E357A31C-B1A2-424B-8A5A-E7D499A92C73}
2016-11-22 17:16:03.187 submit Crashlytics: Failed to prepare the binary for release

Been pulling my hair out over this all day, hoping someone can shed some light on this problem.


Solution

  • Ok so turns out you need to run the app on a device directly from Xcode on the server machine so that Xcode will automatically generate all the appropriate XC iOS provisioning profiles. Apparently the Crashlytics script will re-package the IPA and need valid provisioning profiles in order to do so. I think the Xcode Bot generates an IPA but it is not fully code signed until you save from the bot results, instead of just running from a bot post-trigger.

    If you go to the developer.apple.com portal and look under Provisioning Profiles you should see something like this: enter image description here