Codesign returned 1 (object ifile format invalid or unsuitable) bug

前端 未结 3 644
忘了有多久
忘了有多久 2020-12-23 14:09

I\'m working with Xcode 4.1 build 4B110f trying to get my iOS app ready for upload. It passes the Product|Archive step with no errors, asking twice for permission to sign s

相关标签:
3条回答
  • Just so that this can be taken off the unanswered list. Like you said, you need to add CODESIGN_ALLOCATE to the $ENV array:

    $ENV{CODESIGN_ALLOCATE} = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate';
    

    If everyone is in agreement here, I think this question can finally be closed.

    When using a more recent version of Xcode, the default location is:

    $ENV{CODESIGN_ALLOCATE} = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate';
    
    0 讨论(0)
  • 2020-12-23 14:34

    In case you get this on a recent version of Xcode, what you actually want is, in the shell:

    export CODESIGN_ALLOCATE=`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    

    which will use the codesign_allocate from the version of Xcode you are using.

    You can update the version of Xcode the command line tools use by running xcode-select -switch

    0 讨论(0)
  • 2020-12-23 14:47

    I had this workaround in place for a long time, but after upgrading to Xcode 4.3 with iOS 5.1 SDK, my signing script (which calls codesign) stopped working with a cannot find code object on disk error:

    output/Enterprise/Payload/MyProduct.app/MyProduct: replacing invalid existing signature    
    output/Enterprise/Payload/MyProduct.app/MyProduct: cannot find code object on disk     
    Code signing failed, not creating .ipa file    
    

    It seems this workaround isn't necessary for binaries built with Xcode 4.3. To fix, I updated my bash script to check if the location exists before exporting it:

      # Only export the environment variable if the location exists,
      # otherwise it breaks the signing process!
      if [ -f "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate" ]
      then
        echo Export environment variable for codesign_allocate location
        export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
      fi
    
    0 讨论(0)
提交回复
热议问题