title: Codesign issue when Jenkins is used
body: <p>If I build the iOS (part of a Xamarin.Forms project) with the Jenkins web GUI (directly running on the Mac) I get the following meaningful error from the console output:</p>
  
  <blockquote>
    <p>unknown error -1=ffffffffffffffff </p>
  </blockquote>
  
  <p>More detailed log</p>
  
  <pre><code>[exec] _CodesignNativeLibraries:
  [exec]   CodesignNativeLibraries Task
  [exec]     AppBundleDir: bin/iPhone/Release/AppiOS.app
  [exec]     CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
  [exec]     DisableTimestamp: False
  [exec]     IntermediateOutputPath: obj/iPhone/Release/codesign
  [exec]     Keychain: &lt;null&gt;
  [exec]     SigningKey: XXX
  [exec]     ExtraArgs: &lt;null&gt;
  [exec] _CodesignAppBundle:
  [exec]   Codesign Task
  [exec]     CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
  [exec]     DisableTimestamp: False
  [exec]     Entitlements: obj/iPhone/Release/Entitlements.xcent
  [exec]     Keychain: &lt;null&gt;
  [exec]     Resources:
  [exec]       bin/iPhone/Release/AppiOS.app
  [exec]     ResourceRules: &lt;null&gt;
  [exec]     SigningKey: XXX
  [exec]     ExtraArgs: &lt;null&gt;
  [exec]     IsAppExtension: False
  [exec]   Tool /usr/bin/codesign execution started with arguments: -v --force --sign XXX --entitlements /Users/someuser/.jenkins/workspace/Project/ProjectName/ProjectName.iOS/obj/iPhone/Release/Entitlements.xcent /Users/someuser/.jenkins/workspace/Project/ProjectName/ProjectName.iOS/bin/iPhone/Release/AppiOS.app
  [exec] bin/iPhone/Release/AppiOS.app : error : /Users/someuser/.jenkins/workspace/Project/ProjectName/ProjectName.iOS/bin/iPhone/Release/AppiOS.app: unknown error -1=ffffffffffffffff [/Users/someuser/.jenkins/workspace/Project/ProjectName/ProjectName.iOS/ProjectName.iOS.csproj]
  </code></pre>
  
  <p>On the other side it works without an error if I build</p>
  
  <ul>
  <li>in Xamarin Studio</li>
  <li>in Visual Studio for Mac</li>
  <li>while connected via Mac build host</li>
  <li>on terminal</li>
  </ul>
  
  <p>After some research the <a href="https://stackoverflow.com/questions/46111418/xamarin-forms-ios-error-replacing-existing-signature">following solutions</a> were mentioned:</p>
  
  <ul>
  <li>allow access to keychain</li>
  <li>revoke and create new certificates/provisioning profiles</li>
  </ul>
  
  <p>I tried both and I'm still getting the error. The question for me is, why Jenkins  launched with</p>
  
  <pre><code>launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
  </code></pre>
  
  <p>can't access the certificates/provisioning profiles. This is the call from <em>Ant</em> in the configuration</p>
  
  <pre><code>&lt;target name="buildIpa" depends="init" if="isMac"&gt;
      &lt;exec dir="${basedir}" executable="${msibuild}" failonerror="true"&gt;
          &lt;arg line="&amp;quot;/p:Configuration=Release&amp;quot; /p:Platform=&amp;quot;iPhone&amp;quot; /p:IpaPackageDir=&amp;quot;./bin&amp;quot; /t:Build ${TopLevelProject}.sln "/&gt;
      &lt;/exec&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>, where <code>msibuild</code> is <code>/Libary/Frameworks/Mono.framework/Versions/Current/Commands/msbuild</code>.</p>
  
  <p>The other projects (Droid, UWP) are also build and I don't know how to only build for iOS ...</p>
  
  <p>How can I find out if there is a signing error, an error with the installation of Jenkins or other error?</p>
  
  <p>My current setup:</p>
  
  <p>Mac OS X: 10.12.6<br>
  Xcode: 9.1<br>
  Visual Studio Community 2017 for Mac: 7.2.2<br>
  Mono: 5.4.1.6<br>
  Xamarin.iOS: 11.3.0.47<br>
  Xamarin.Forms: 2.3.4.267<br>
  Xamarin Studio on Mac: 6.3<br>
  Jenkins: 2.73.3</p>