title: iOS builds / ipa creation no longer works from the command line
body: <p><strong>Overview</strong></p>
  
  <p>Our command line builds (to build and create the .ipa) are no longer working. </p>
  
  <p>iTunesConnect has started rejecting builds that use the <code>CODE_SIGN_RESOURCE_RULES_PATH</code> build setting.</p>
  
  <p>If we build WITHOUT that setting the PackageApplication tool (which we use to create the signed .ipa) fails.</p>
  
  <p>It seems that PackageApplication calls /usr/bin/codesign with resource-rules arguments even if the <code>CODE_SIGN_RESOURCE_RULES_PATH</code> build setting is excluded</p>
  
  <p>I suspect the PackageApplication needs to be updated so that it does not call /usr/bin/codesign with resource-rules arguments when the <code>CODE_SIGN_RESOURCE_RULES_PATH</code> build setting is excluded.</p>
  
  <p>Has anyone found a solution for this?</p>
  
  <p><strong>Details</strong></p>
  
  <p>We build our app on the command line like this:</p>
  
  <pre><code>xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO 'CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist'
  </code></pre>
  
  <p>We create the signed .ipa on the command line like this:</p>
  
  <pre><code>xcrun -log -sdk iphoneos PackageApplication "/Users/mpv/dev/myApp/build/AppStoreDistribution-iphoneos/myApp.app" -o "/Users/mpv/dev/myApp/build/AppStoreDistribution-iphoneos/myApp.ipa" -sign "iPhone Distribution: MyTeam (XXXXXXXXXX)" -embed /Users/mpv/Library/MobileDevice/Provisioning\ Profiles/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.mobileprovision
  </code></pre>
  
  <p>iTunesConnect is now rejecting our builds with the following error:</p>
  
  <blockquote>
    <p>"This bundle is invalid. The Info.plist contains an invalid key
    'CFBundleResourceSpecification' in bundle myApp [myApp.app]"</p>
  </blockquote>
  
  <p>If we remove the <code>'CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist'</code> bit from the build command then the app is built without the <code>CFBundleResourceSpecification</code> plist key (which I presume is what we want). The new build command looks like this:</p>
  
  <pre><code>xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO 
  </code></pre>
  
  <p>The problem now is that the command to build the .ipa fails with the following error:</p>
  
  <blockquote>
    <p>error: /usr/bin/codesign --force
    --preserve-metadata=identifier,entitlements,resource-rules --sign iPhone Distribution: MyTeam (XXXXXXXXXX)
    --resource-rules=/var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app/ResourceRules.plist
    --entitlements /var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/entitlements_plistIUdGWLYe
    /var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app
    failed with error 1. Output: Warning: usage of --preserve-metadata
    with option "resource-rules" (deprecated in Mac OS X >= 10.10)!</p>
    
    <p>Warning: --resource-rules has been deprecated in Mac OS X >= 10.10!
    /var/folders/2b/7hylk7nn13dgrl9yyh2wp0lm0000gn/T/zDRRJMkKtQ/Payload/myApp.app/ResourceRules.plist:
    cannot read resources</p>
  </blockquote>
  
  <p>It seems that PackageApplication calls /usr/bin/codesign with resource-rules arguments even if the <code>CODE_SIGN_RESOURCE_RULES_PATH</code> argument / build setting is excluded.</p>
  
  <p>I think PackageApplication needs to be updated so that it does not call /usr/bin/codesign with resource-rules arguments when the <code>CODE_SIGN_RESOURCE_RULES_PATH</code> argument / build setting is excluded.</p>