title: Signing errors with use_frameworks! and unique provisioning profiles
body: <p>I am pasting my last post from Initial discussion here:</p>
  
  <p><a href="https://github.com/CocoaPods/CocoaPods/issues/4331" rel="noreferrer">https://github.com/CocoaPods/CocoaPods/issues/4331</a></p>
  
  <p>This issue has been around for almost a year, and still no proper solutions found.</p>
  
  <p>When building:</p>
  
  <pre><code>Code Sign error: Provisioning profile does not match bundle identifier: The provisioning profile specified in your build settings (“MyDistributionProfileName”) has an AppID of “com.myorg.myapp” which does not match your bundle identifier “org.cocoapods.PureLayout”.
  </code></pre>
  
  <p>Note! PureLayout is added to my pod as a dependency using(in mypod.podspec file):
   <code>s.dependency 'PureLayout', '3.0.2'</code></p>
  
  <p>This is the whole podspec file of my Pod:</p>
  
  <pre><code>Pod::Spec.new do |s|
    s.name                = 'MyPod'
    s.version             = '1.2.34'
    s.license             =  { :type =&gt; "MIT", :file =&gt; "LICENSE" }
    s.homepage            = 'https-:-//bitbucket.org/XXXX123/my-pod'
    s.authors             = { "AuthorName" =&gt; "author@myorg.com" }
    s.summary             = 'This isa a cocoa pod that contains the MY framework.'
    s.source              = { :git =&gt; "https-:-//bitbucket.org/XXXX123/my-pod", :tag =&gt; "#{s.version}" }
    s.ios.deployment_target = '8.0'
    s.source_files        = 'MyPod/**/*.{swift,h}'
    s.resource = 'MyPod/*'
    s.pod_target_xcconfig = { 'ENABLE_BITCODE' =&gt; 'NO', 'ONLY_ACTIVE_ARCH' =&gt; 'NO'}
    s.dependency 'PureLayout', '3.0.2'
  end
  </code></pre>
  
  <hr>
  
  <p>Notes:</p>
  
  <ol>
  <li><p>Dropping use of CocoaPods is not an option.</p></li>
  <li><p>Using the @DimaVartanian fix leads to similar errors like encountered by @mgrebenets</p>
  
  <blockquote>
    <p><strong>ERROR ITMS-90035</strong>  Invalid Signature. Code object is not signed at all. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a Simulator target. If you are certain your code signing settings are correct, choose "Clean All" in Xcode, delete the "build" directory in the Finder, and rebuild your release target. For more information, please consult https-:-//developer.apple.com/library/ios/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html"</p>
    
    <p><strong>ERROR ITMS-90171</strong> Invalid Bundle Structure - The binary file 'XApp.app/Frameworks/X.framework/XView.o' is not permitted. Your app can’t contain standalone executables or libraries, other than the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https-:-//developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.</p>
  </blockquote></li>
  <li><p>My project uses also PushNotifications so can't use any wildcard provision profiles.</p></li>
  <li><p>Here's my gym line for building a build</p>
  
  <pre><code>gym --clean --scheme ${XCODE_PROJECT_TARGET_NAME} --configuration Release --include_bitcode false --archive_path ${BUILDS_DIR}${PACKAGE_NAME}.xcarchive --output_directory $BUILDS_DIR --output_name "${PACKAGE_NAME}.ipa" --xcargs PROVISIONING_PROFILE=$APP_PROVISION_UUID
  </code></pre>
  
  <p>This line works without any errors when @DimaVartanian fix is applied, but as above, it leads to  <strong>ERROR ITMS-90035</strong> and <strong>ERROR ITMS-90171</strong> during upload process.</p>
  
  <p>Here's my pilot line for uploading a build:</p>
  
  <pre><code>pilot upload --skip_submission --username ${APPLE_ID_USERNAME} --team_id ${APPLE_ITUNES_CONNECT_TEAM_ID} --verbose --ipa ${BUILDS_DIR}${PACKAGE_NAME}.ipa --skip_waiting_for_build_processing true
  </code></pre></li>
  <li><p>I can also confirm that same issue exists when build/archive/upload using xcode.</p></li>
  <li><p>Adding this <code>--export_options "ExportOptions.plist"</code> to gym commandline, did not make any difference. Also failed by trying via xcargs <code>--xcargs "PROVISIONING_PROFILE=$APP_PROVISION_UUID exportOptionsPlist=$EXPORT_OPTIONS_PLIST"</code>.</p>
  
  <p>Contents of the file is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
     &lt;key&gt;teamID&lt;/key&gt;
     &lt;string&gt;TEAMID123&lt;/string&gt;
     &lt;key&gt;uploadSymbols&lt;/key&gt;
     &lt;string&gt;NO&lt;/string&gt;
     &lt;key&gt;compileBitcode&lt;/key&gt;
     &lt;false/&gt;
     &lt;key&gt;uploadBitcode&lt;/key&gt;
     &lt;false/&gt;
     &lt;key&gt;method&lt;/key&gt;
     &lt;string&gt;app-store&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre></li>
  </ol>
  
  <p>I am hoping the CocoaPods team will fix this quickly.</p>
  
  <p>To say in short - what fails is the end of following sequence:</p>
  
  <ol>
  <li>Create base project in Objectvie-C or take any old maintained Objective-C project</li>
  <li>Create and implement a framework <em>(Cocoa Touch Framework)</em> project in Swift</li>
  <li>Create podspec for that framework and upload it to repository</li>
  <li>Include that framework into base project using CocoaPods</li>
  <li>Build and run app on simulator and on wired device is OK <em>(everything works as expected)</em></li>
  <li><strong>Build and/or Upload to iTunesConnect is NOT OK, it FAILS!</strong></li>
  </ol>
  
  <p>I will try to add a sample project later on, to demo the issue.</p>