title: Error uploading to itunes connect using fastlane
body: <p>Firstly, here's the error:</p>
  
  <pre><code>22:13:47]: [Transporter Error Output]: ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.fitbugg.apps.FitBugg [Payload/FitBugg.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."
  [22:13:47]: Transporter transfer failed.
  [22:13:47]:
  [22:13:47]: ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.fitbugg.apps.FitBugg [Payload/FitBugg.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."
  [22:13:47]: ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.fitbugg.apps.FitBugg [Payload/FitBugg.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."
  Return status of iTunes Transporter was 1: ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.fitbugg.apps.FitBugg [Payload/FitBugg.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."
  The call to the iTMSTransporter completed with a non-zero exit status: 1. This indicates a failure.
  [22:13:47]: Variable Dump:
  [22:13:47]: {:DEFAULT_PLATFORM=&gt;:ios, :PLATFORM_NAME=&gt;:ios, :LANE_NAME=&gt;"ios beta", :CERT_FILE_PATH=&gt;"/Users/james/Documents/workspace/fb-ios-recover/K3E6UZV9MX.cer", :CERT_CERTIFICATE_ID=&gt;"K3E6UZV9MX", :SIGH_PROFILE_PATH=&gt;"/Users/james/Documents/workspace/fb-ios-recover/AppStore_com.fitbugg.apps.FitBugg.mobileprovision", :SIGH_PROFILE_PATHS=&gt;["/Users/james/Documents/workspace/fb-ios-recover/AppStore_com.fitbugg.apps.FitBugg.mobileprovision"], :SIGH_UDID=&gt;"2cf7a401-960e-4e39-a2f9-2f6627f0642c", :SIGH_PROFILE_TYPE=&gt;"app-store", :IPA_OUTPUT_PATH=&gt;"/Users/james/Documents/workspace/fb-ios-recover/FitBugg.ipa", :DSYM_OUTPUT_PATH=&gt;"/Users/james/Documents/workspace/fb-ios-recover/FitBugg.app.dSYM.zip", :XCODEBUILD_ARCHIVE=&gt;"/Users/james/Library/Developer/Xcode/Archives/2016-08-04/FitBugg 2016-08-04 22.09.00.xcarchive"}
  [22:13:47]: Error uploading ipa file, for more information see above
  </code></pre>
  
  <p>Here's the Fastfile:</p>
  
  <pre><code># Customise this file, documentation can be found here:
  # https://github.com/fastlane/fastlane/tree/master/fastlane/docs
  # All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
  # can also be listed using the `fastlane actions` command
  
  # Change the syntax highlighting to Ruby
  # All lines starting with a # are ignored when running `fastlane`
  
  # If you want to automatically update fastlane if a new version is available:
  # update_fastlane
  
  # This is the minimum version number required.
  # Update this, if you use features of a newer version
  fastlane_version "1.98.0"
  #username 'james@fitbugg.com'
  
  #app_identifier 'com.fitbugg.apps.FitBugg'
  #PRODUCT_BUNDLE_IDENTIFIER='com.fitbugg.apps.FitBugg'
  
  default_platform :ios
  
  platform :ios do
    before_all do
      # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
  #cocoapods
      cocoapods(podfile: 'Podfile')
  
    end
  
  #  desc "Runs all the tests"
  #  lane :test do
  #    scan
  #  end
  
    desc "Submit a new Beta Build to Apple TestFlight"
    desc "This will also make sure the profile is up to date"
    lane :beta do
      cert 
      sigh(force: true)
      match(type: "appstore") # more information: https://codesigning.guide
      gym(scheme: "FitBugg") # Build your app - more options available
  #gym # Build your app - more options available
      pilot
  
      # sh "your_script.sh"
      # You can also use other beta testing services here (run `fastlane actions`)
    end
  
  #  desc "Deploy a new version to the App Store"
  #  lane :fitbuggappstore do
      # match(type: "appstore")
      # snapshot
  #    gym(scheme: "FitBugg") # Build your app - more options available
  #    deliver(force: true)
      # frameit
  #  end
  
    # You can define as many lanes as you want
  
    after_all do |lane|
      # This block is called, only if the executed lane was successful
  
      # slack(
      #   message: "Successfully deployed new App Update."
      # )
    end
  
    error do |lane, exception|
      # slack(
      #   message: exception.message,
      #   success: false
      # )
    end
  end
  
  
  # More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  # All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
  
  # fastlane reports which actions are used
  # No personal data is recorded. Learn more at https://github.com/fastlane/enhancer
  </code></pre>
  
  <p>Various commands I've run are:</p>
  
  <p><code>match (development, distribution)</code></p>
  
  <p><code>cert create</code></p>
  
  <p>To me it seems to be close, but what I can't figure out is why the provisioning profile isn't valid. I thought fastlane uploaded it for me. </p>
  
  <p>Here's my view of provisioning profiles on Apple Dev Conn:
  <a href="https://i.stack.imgur.com/AjEIg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AjEIg.png" alt="enter image description here"></a></p>
  
  <p>And my certs on the ADC:</p>
  
  <p><a href="https://i.stack.imgur.com/W9DRN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W9DRN.png" alt="enter image description here"></a></p>