title: Testing iCloud outside XCode : Signature invalid
body: <p>So, I am working on a Mac application, with iCloud feature.  Within Xcode, everything is fine.  I am using the Mac developer certificate paired with the Mac team profile (code signing identity, from build setting).  When I compile and run, I can save/load files from iCloud.  I am happy.</p>
  
  <p>Where I am not happy, this is when I create the package and send it to the testers.  The application is not starting at all!  I have the following output from the console : </p>
  
  <pre><code>12-02-13 3:50:09.796 PM sandboxd: ([51185]) taskgated-helper(51185) deny mach-lookup com.apple.ocspd
  12-02-13 3:50:09.796 PM sandboxd: ([51185]) taskgated-helper(51185) deny mach-lookup com.apple.ocspd
  12-02-13 3:50:09.796 PM sandboxd: ([51185]) taskgated-helper(51185) deny mach-lookup com.apple.ocspd
  12-02-13 3:50:09.797 PM sandboxd: ([51185]) taskgated-helper(51185) deny mach-lookup com.apple.ocspd
  12-02-13 3:50:09.867 PM ReportCrash: Saved crash report for myAppName[51195] version ??? (???) to /Users/plboily/Library/Logs/DiagnosticReports/myAppName_2012-02-13-155009_Blinky.crash
  12-02-13 3:50:09.870 PM ReportCrash: Removing excessive log: file://localhost/Users/plboily/Library/Logs/DiagnosticReports/myAppName_2012-02-03-113847_Blinky.crash
  12-02-13 3:50:10.000 PM kernel: CODE SIGNING: cs_invalid_page(0x1000): p=51195[myAppName ] honoring CS_KILL, final status 0x10201
  12-02-13 3:50:10.000 PM kernel: CODE SIGNING: cs_invalid_page(0x1000): p=51195[myAppName ] clearing CS_VALID
  </code></pre>
  
  <p>The following is a snippet of the crash log :</p>
  
  <pre><code>Exception Type:  EXC_CRASH (Code Signature Invalid)
  Exception Codes: 0x0000000000000000, 0x0000000000000000
  
  Thread 0 Crashed:
  0   dyld                            0x8fea9280 dyldbootstrap::start(macho_header const*,  int, char const**, long, macho_header const*) + 526
  1   dyld                            0x8fea9063 _dyld_start + 51
  </code></pre>
  
  <p>Any idea what's wrong?
  Anybody know why i have these problems?  I already have my Mac team profile in my system profile</p>
  
  <p>By the way, when I do build on our build machine, there is a _<em>CodeSignature</em> folder appearing into the .app folder, plus an <em>embedded.provisioningprofile</em> file.  Everything seems to be there.  I am wondering if I do have to add the code signing identity to ALL targets of my project?  Right now, i only signed the application target.</p>
  
  <p>Thank you</p>