Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcode 9 beta export options not working #9589

Closed
2 tasks done
jetersen opened this issue Jun 27, 2017 · 66 comments
Closed
2 tasks done

xcode 9 beta export options not working #9589

jetersen opened this issue Jun 27, 2017 · 66 comments

Comments

@jetersen
Copy link
Contributor

jetersen commented Jun 27, 2017

New Issue Checklist

Issue Description

Extension of #9458
Project builds but come export for ad-hoc or release. I get the following output

Same error on xcode 9 beta 2.

Complete output when running fastlane, including the stack trace and command used

Run locally and pretending I am Jenkins to run match.
JENKINS_HOME=a fastlane beta

Fastlane failed to capture output, below output is enough, imho.

[14:22:08]: ▸ Archive Succeeded
[14:22:08]: Generated plist file with the following values:
[14:22:08]: ▸ -----------------------------------------
[14:22:08]: ▸ {
[14:22:08]: ▸   "provisioningProfiles": {
[14:22:08]: ▸     "[\"com.widex.app\", \"com.widex.app.watchkitapp\", \"com.widex.app.watchkitapp.watchkitextension\"]": null
[14:22:08]: ▸   },
[14:22:08]: ▸   "method": "ad-hoc"
[14:22:08]: ▸ }
[14:22:08]: ▸ -----------------------------------------
/usr/local/lib/ruby/gems/2.4.0/gems/plist-3.2.0/lib/plist/generator.rb:97: warning: constant ::Fixnum is deprecated
/usr/local/lib/ruby/gems/2.4.0/gems/plist-3.2.0/lib/plist/generator.rb:97: warning: constant ::Bignum is deprecated
[14:22:08]: $ /usr/bin/xcrun /usr/local/lib/ruby/gems/2.4.0/gems/fastlane-2.41.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/gj/99cx5fcd3tv6wv16lb88pys9y555lm/T/gym_config20170627-58865-13cmzw6.plist' -archivePath /Users/bob/bitbucket/beyond/ios/output/AppNative\ 2017-06-27\ 14.20.56.xcarchive -exportPath '/var/folders/gj/99cx5fcd3tv6wv16lb88pys9y555lm/T/gym_output20170627-58865-1gnfxve'
+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/gj/99cx5fcd3tv6wv16lb88pys9y555lm/T/gym_config20170627-58865-13cmzw6.plist -archivePath '/Users/bob/bitbucket/beyond/ios/output/AppNative 2017-06-27 14.20.56.xcarchive' -exportPath /var/folders/gj/99cx5fcd3tv6wv16lb88pys9y555lm/T/gym_output20170627-58865-1gnfxve
2017-06-27 14:22:08.997 xcodebuild[59928:11499459] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/gj/99cx5fcd3tv6wv16lb88pys9y555lm/T/AppNative_2017-06-27_14-22-08.996.xcdistributionlogs'.
2017-06-27 14:22:09.862 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:09.873 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.212 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.212 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.213 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.278 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.279 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.280 xcodebuild[59928:11499459] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13152.18/DVTFoundation/DeveloperStructure/DVTPlatformFamily.m:192
Details:  Error Domain=DVTMachOErrorDomain Code=1 "Reached end of file while looking for: Mach-O slice." UserInfo={NSLocalizedDescription=Reached end of file while looking for: Mach-O slice., NSLocalizedRecoverySuggestion=}
Object:   <NSBundle>
Method:   +dvt_platformFamilyForBundleAtPath:error:
Thread:   <NSThread: 0x7fa034c16360>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
2017-06-27 14:22:10.554 xcodebuild[59928:11499459] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fa0376f4140>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
"Error Domain=IDEProfileLocatorErrorDomain Code=1 \"No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found\" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app.watchkitapp.watchkitextension'.}",
"Error Domain=IDEProfileLocatorErrorDomain Code=1 \"No profiles for 'com.widex.app.watchkitapp' were found\" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app.watchkitapp' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app.watchkitapp'.}",
"Error Domain=IDEProfileLocatorErrorDomain Code=1 \"No profiles for 'com.widex.app' were found\" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app'.}"
)}
error: exportArchive: No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app.watchkitapp.watchkitextension'.}

error: exportArchive: No profiles for 'com.widex.app.watchkitapp' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.widex.app.watchkitapp' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app.watchkitapp' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app.watchkitapp'.}

error: exportArchive: No profiles for 'com.widex.app' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.widex.app' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app'.}

** EXPORT FAILED **
[14:22:10]: Exit status: 70
[14:22:10]: 📋  For a more detailed error log, check the full log at:
[14:22:10]: 📋  /Users/bob/bitbucket/beyond/ios/fastlane/logs/gym/AppNative-AppNative.log
+------------------------------------+---------------------------------------------------------------------------------------------------------------+
|                                                                    Lane Context                                                                    |
+------------------------------------+---------------------------------------------------------------------------------------------------------------+
| DEFAULT_PLATFORM                   | ios                                                                                                           |
| PLATFORM_NAME                      | ios                                                                                                           |
| LANE_NAME                          | ios beta                                                                                                      |
| ORIGINAL_DEFAULT_KEYCHAIN          | "/Users/bob/Library/Keychains/login.keychain-db"                                                              |
| BUILD_NUMBER                       | 7                                                                                                             |
| SIGH_PROFILE_TYPE                  | ad-hoc                                                                                                        |
| MATCH_PROVISIONING_PROFILE_MAPPING | {["com.widex.app", "com.widex.app.watchkitapp", "com.widex.app.watchkitapp.watchkitextension"]=>nil}          |
+------------------------------------+---------------------------------------------------------------------------------------------------------------+

Environment

🚫 fastlane environment 🚫

Stack

Key Value
OS 10.12.5
Ruby 2.4.1
Bundler? false
Git git version 2.13.2
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.12.5 (16F73)
Ruby Lib Dir /usr/local/Cellar/ruby/2.4.1_1/lib
OpenSSL Version OpenSSL 1.0.2k 26 Jan 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 8.3.3

System Locale

Error
No Locale with UTF8 found �

fastlane files:

`./fastlane/Fastfile`
fastlane_version '2.39.2'
xcversion version: '~> 9'

default_platform :ios

is_jenkins = (true == is_ci?)

platform :ios do
  before_all do
    # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
    ENV['swiftlint'] = 'fastlane/.swiftlint.yml'
    ENV['scheme'] = 'AppNative'
    ENV['APP_IDENTIFIER'] = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
    setup_jenkins(keychain_path: 'jenkins') if is_jenkins
  end

  desc 'Runs build/gym'
  lane :build do |options|
    if is_jenkins
      FileUtils.rm_rf('../output')
      ENV['FL_BUILDLOG_PATH'] = 'fastlane/logs'
      increment_build_number build_number: ENV['BUILD_NUMBER']
      type = options[:type] || 'development'
      match(
        type: type,
        readonly: true,
        app_identifier: [
          ENV['APP_IDENTIFIER'],
          "#{ENV['APP_IDENTIFIER']}.watchkitapp",
          "#{ENV['APP_IDENTIFIER']}.watchkitapp.watchkitextension"
        ]
      )
    end
    gym(
      configuration: options[:configuration] || 'Debug',
      export_method: options[:export_method] || 'development',
      xcargs: "APP_IDENTIFIER=#{ENV['APP_IDENTIFIER']}"
    )
  end

  lane :alpha do
    build(
      type: 'development',
      configuration: 'Release'
    )
  end

  desc 'Submit a new Beta Build to Apple TestFlight'
  lane :beta do
    build(
      type: 'adhoc',
      configuration: 'Release',
    )
  end

  desc 'Deploy a new version to the App Store, meant for Jenkins'
  lane :release do
    build(
      type: 'appstore',
      configuration: 'Release'
    )
  end

  desc "Upload metadata"
  lane :metadata do |options|
    Dir.glob("metadata/**/*.txt") do |filename|
      text = File.read(filename)
      normalized = text.unicode_normalize(:nfc)
      File.open(filename, "w") { |file| file.puts normalized }
    end
    deliver(
      username: options[:username],
      skip_binary_upload: true,
      skip_screenshots: true,
      app_rating_config_path: 'fastlane/rating_config.json',
      force: is_jenkins
    )
  end

  # You can define as many lanes as you want

  after_all do |lane|
  end

  error do |lane, exception|
  end
end
`./fastlane/Appfile`
app_identifier "com.widex.apptwo" # The bundle identifier of your app

for_platform :ios do
  for_lane :beta do
    app_identifier "com.widex.app"
  end
  for_lane :release do
    app_identifier "com.widex.app"
  end
end

fastlane gems

Gem Version Update-Status
fastlane 2.41.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.1.0
slack-notifier 1.5.1
CFPropertyList 2.3.5
claide 1.0.1
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.4.4
rouge 1.11.1
xcpretty 0.2.4
terminal-notifier 1.7.1
unicode-display_width 1.1.3
terminal-table 1.7.3
plist 3.2.0
public_suffix 2.0.5
addressable 2.5.1
multipart-post 2.0.0
word_wrap 1.0.0
tty-screen 0.5.0
babosa 1.0.2
colored 1.2
highline 1.7.8
commander-fastlane 4.4.4
excon 0.55.0
faraday 0.11.0
unf_ext 0.0.7.2
unf 0.1.4
domain_name 0.5.20170223
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
fastimage 2.1.0
gh_inspector 1.0.3
uber 0.0.15
declarative 0.0.9
declarative-option 0.1.0
representable 3.0.4
retriable 2.1.0
mime-types-data 3.2016.0521
mime-types 3.1
little-plugger 1.1.4
multi_json 1.12.1
logging 2.2.0
jwt 1.5.6
memoist 0.15.0
os 0.9.6
signet 0.7.3
googleauth 0.5.1
httpclient 2.8.3
google-api-client 0.12.0
json 2.0.2
mini_magick 4.5.1
multi_xml 0.6.0
rubyzip 1.2.1
security 0.1.3
xcpretty-travis-formatter 0.0.4
dotenv 2.2.0
bundler 1.14.6
faraday_middleware 0.11.0.1
io-console 0.4.6
openssl 2.0.3

generated on: 2017-06-27

@fastlane-bot
Copy link

It seems like this issue might be related to code signing 🚫

Have you seen our new Code Signing Troubleshooting Guide? It will help you resolve the most common code signing issues 👍

@jetersen
Copy link
Contributor Author

@fastlane-bot NO, I DO NOT.

@jetersen jetersen changed the title xcode 9 beta 1 export options not working xcode 9 beta export options not working Jun 27, 2017
@jetersen
Copy link
Contributor Author

Project is running automatic signing with iPhone Developer.

@jetersen
Copy link
Contributor Author

jetersen commented Jun 27, 2017

Oh it might be the fact that we switched to workspace since I last tested it.
But I don't think so

@mgrebenets
Copy link
Collaborator

@Casz
Do you have one or multiple instance of Jenkins?

I can see that your export expects certain profiles to be on the disk.
Do you have those profiles included into git repo?
Or do you fetch them with sigh or match?
Or do you have a custom provisioning setup that uploads provisioning profiles on all Jenkins build agents?

The error is very clear, it simply can't find the profiles.
I would assume it's trying to find profiles matching PROVISIONING_PROFILE_SPECIFIER build setting.
Do you have that build setting properly configured?
The PROVISIONING_PROFILE has been deprecated and should probably be empty.

I also see that your fastlane script is using provisioningProfiles option for -exportOptionsPlist:

	provisioningProfiles : Dictionary

		For manual signing only. Specify the provisioning profile to use for each executable in your app. Keys in this dictionary are the bundle identifiers of executables; values are the provisioning profile name or UUID to use.

But the documentation says For manual signing only, while you say that you use automatic signing. Maybe that's the reason. What is the exact fastlane action that you use to create and export IPA?

@jetersen
Copy link
Contributor Author

jetersen commented Jun 27, 2017

Check the fastfile included in fastlane environment.
But to answer you question, using match.
The provisioning profiles in xcode 9 from my understanding should work with Automatic.

The provision profiles is auto generated when using xcode 9 and latest fastlane

This is run locally, not on Jenkins.
Though I see the same behaviour on Jenkins.

@jetersen
Copy link
Contributor Author

jetersen commented Jun 27, 2017

Yes running xcodebuild -help does show that provisioningProfiles is only for manual signing.

After switching to manual signing I still get the same error shown in the issue.

@mgrebenets
Copy link
Collaborator

mgrebenets commented Jun 27, 2017

When switching to manual signing, do you have your DEVELOPMENT_TEAM and PROVISIONING_PROFILE_SPECIFIER build settings properly configured in Xcode project?

You are not passing those to gym, so I assume they'd need to be configured in Xcode project (or maybe xcconfig, whatever approach you use).

Also, the "com.widex.app" needs to be the specifier of the provisioning profile, aka name, but not the name of the file or not the bundle ID.

For example, this is how it looks inside the profile:

	<key>Name</key>
	<string>WildcardDevelopment</string>

Your logs seem to be using Ad-Hoc distribution type, which means match will try to get profiles for ad-hoc distribution. I can't see from the logs if match was successful, but I'd assume it was.

If your development profile has com.wides.app specifier, then I think ad-hoc profile can't have the same specifier. If I understand it correctly, identifiers need to be unique. (Don't take my word for it :), I'm not so sure about names being unique, would have to check).

It's not just failing to find a provisioning profile, it fails to find a profile for Ad Hoc distribution in particular.

@jetersen
Copy link
Contributor Author

jetersen commented Jun 28, 2017

This PR #9432 is part of the new xcode 9 feature where we should be able to avoid using PROVISIONING_PROFILE_SPECIFIER.
Match is passing the values to GYM

# Since Xcode 9 you need to explicitly provide the provisioning profile per app target
# If the user is smart and uses match and gym together with fastlane, we can do all
# the heavy lifting for them
values[:export_options] ||= {}
# It's not always a hash, because the user might have passed a string path to a ready plist file
# If that's the case, we won't set the provisioning profiles
# see https://github.com/fastlane/fastlane/issues/9490
if values[:export_options].kind_of?(Hash)
values[:export_options][:provisioningProfiles] = Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]

As mentioned build was successful ie. match was successful.
image

@jetersen
Copy link
Contributor Author

@KrauseFx Am I completely mistaken?

@jetersen
Copy link
Contributor Author

jetersen commented Jun 28, 2017

To put more context, our project builds with Xcode 8 and manuel signing swap on our master branch.
But on our xcode9 branch we are testing builds for Xcode 9, hereby this feature included.

@qnoid
Copy link

qnoid commented Aug 2, 2017

Disclaimer I am not at all familiar with how fastlane works.

From Xcode 9 beta release notes (emphasis mine)

When automatically signing for distribution, Xcode will now create and use only Xcode- managed distribution provisioning profiles. This behavior is functionally analogous to automatic signing for development, and means that Xcode will no longer create or modify any of your manually created distribution provisioning profiles. Xcode-managed distribution provisioning profiles are supported for all distribution methods except for Developer ID distribution. xcodebuild -exportArchive now fully supports automatic signing, including creating and updating signing assets, if you pass the -allowProvisioningUpdates flag.

So it might be just a case of passing the -allowProvisioningUpdates flag when using xcodebuild -exportArchive if there is a way in fastlane to do so.

@ohayon
Copy link
Contributor

ohayon commented Aug 9, 2017

Hey folks! In trying to reproduce this issue, I have run into another set of Xcode 9 bugs. I am wondering if you all are still seeing this issue or if anything new has cropped up? Let us know if its still going on! 🚀

@Reedyuk
Copy link

Reedyuk commented Aug 30, 2017

@ohayon I am also getting this problem, the issue i have is i try to do this in my fastlane fastfile:
gym(scheme: "Dev", xcargs: "-allowProvisioningUpdates")
but the command to build fails, i check my server log and i see that -allowProvisioningUpdates is not added to the following command that runs and fails:
xcodebuild -exportArchive -exportOptionsPlist /var/folders/nc/1xtbny1j5fn33m1w6smkvxth000086/T/gym_config20170830-44505-y97lri.plist -archivePath '/Users/Shared/Jenkins/Library/Developer/Xcode/Archives/2017-08-30/Dev 2017-08-30 16.23.26.xcarchive' -exportPath /var/folders/nc/1xtbny1j5fn33m1w6smkvxth000086/T/gym_output20170830-44505-12k2qp5

When i manually run that command with the additional -allowProvisioningUpdates then it works a treat.
I dont use match, but this should work without match anyway.
I guess this means that the xcargs dont get passed on the exportArchive stage of building with gym.

@appfrilans
Copy link

I have the exact same issue. Xcode 9 beta, automatic signing. Feels like this is quite urgent as XCode 9 is about to go public.

@taher-mosbah
Copy link

taher-mosbah commented Sep 4, 2017

Same issue here

@nghuiqin
Copy link

nghuiqin commented Sep 7, 2017

I use Xcode 9 beta and manually upload to Store, it stated that only non-beta version is allowed. Is that the reason for this problem?

@KrauseFx
Copy link
Member

KrauseFx commented Sep 7, 2017

Everyone, please read the complete output. Only one person here shared their output, and it clearly explains the error

error: exportArchive: No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app.watchkitapp.watchkitextension' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app.watchkitapp.watchkitextension'.}

error: exportArchive: No profiles for 'com.widex.app.watchkitapp' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.widex.app.watchkitapp' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app.watchkitapp' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app.watchkitapp'.}

error: exportArchive: No profiles for 'com.widex.app' were found

Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.widex.app' were found" UserInfo={NSLocalizedDescription=No profiles for 'com.widex.app' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS Ad Hoc provisioning profiles matching 'com.widex.app'.}

please read the output, or share it here, so we can help

@KrauseFx
Copy link
Member

KrauseFx commented Sep 7, 2017

Also, this does not seem like it's an issue with fastlane

@Reedyuk
Copy link

Reedyuk commented Sep 8, 2017

Strange, as i managed to get the app to upload via Xcode from the same machine and it worked.
I then ran the fast lane failing command from the terminal but with -allowProvisioningUpdates and it succeeded.

@Reedyuk
Copy link

Reedyuk commented Sep 8, 2017

xcodebuild -exportArchive -exportOptionsPlist /var/folders/nc/1xtbny1j5fn33m1w6smkvxth000086/T/gym_config20170830-44505-y97lri.plist -archivePath '[purple-monkey-dishwasher].xcarchive' -exportPath /var/folders/nc/1xtbny1j5fn33m1w6smkvxth000086/T/gym_output20170830-44505-12k2qp5 [Adding -allowProvisioningUpdates here makes the command work]
2017-08-30 16:33:34.040 xcodebuild[49960:232286] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '[purple-monkey-dishwasher].xcdistributionlogs'.
Exported [purple-monkey-dishwasher].xcarchive to: /var/folders/nc/1xtbny1j5fn33m1w6smkvxth000086/T/gym_output20170830-44505-12k2qp5
** EXPORT SUCCEEDED **

@pmiaskiewicz
Copy link

This issue also affects my project.
As soon as I switch to Xcode9 I see same errors even though source code, fastlane and provisioning profiles/certs are same.

One tip, I use "Automatically manage signing" option, maybe in new xcodebuild it's required to pass -allowProvisioningUpdates to achieve same thing, so maybe there should be an option to pass it with fastlane?

@mooshee
Copy link

mooshee commented Sep 8, 2017

@Reedyuk Instead of xcargs use export_xcargs. I tried the following with success export_xcargs: "-allowProvisioningUpdates"

@Reedyuk
Copy link

Reedyuk commented Sep 8, 2017

where do i use export_xcargs?
Would it be like this?
gym(scheme: "purple-monkey-dishwasher", export_xcargs: "-allowProvisioningUpdates")

@Reedyuk
Copy link

Reedyuk commented Sep 8, 2017

Actually, i can confirm that has done the trick.
Thanks @mooshee

@phips28
Copy link

phips28 commented Sep 14, 2017

export_xcargs: "-allowProvisioningUpdates" works for me!

@tmm1
Copy link
Contributor

tmm1 commented Sep 15, 2017

Had the same issue, adding export_xcargs "-allowProvisioningUpdates" to Gymfile fixed it.

ZevEisenberg pushed a commit to ZevEisenberg/Padiddle that referenced this issue Sep 17, 2017
@dogo
Copy link

dogo commented Oct 12, 2017

thanks @thebugcode

@jonkan
Copy link

jonkan commented Oct 16, 2017

@thebugcode Not sure if this applies to your setup, but in my case I only needed to add signingStyle manual to my export options. It's not very well documented (AFAIK), but you can actually pass a hash as export_options that gym will add to the generated exportOptions.plist, so in my case I just had to add it like this:

gym(
  ...
  export_options: {'signingStyle' => 'manual'}
)

@hackmajoris
Copy link

The trick with allowProvisioningUpdates flag works perfect locally but not when the lane is executed from Jenkins. The same fastfile, the same lane.

@jetersen
Copy link
Contributor Author

jetersen commented Oct 18, 2017

@VIPLORD with -allowProvisioningUpdates you need to open Xcode and add your apple account.

@sander-m
Copy link
Contributor

with -allowProvisioningUpdates you need to open Xcode and add your apple account.

I wonder if anybody here has figured out how to do this programmatically?

@anton-ogarkov
Copy link

@sander-m Does XCode archive your build manually without problems? If yes then try @thebugcode solution or this one

@hackmajoris
Copy link

hackmajoris commented Oct 19, 2017

@Casz Managed to get it working also using Jenkins. Thanks
@sander-m It's enough to configure Xcode one time on your CI machine(in my case) and it will work.

@jetersen
Copy link
Contributor Author

jetersen commented Oct 19, 2017

@VIPLORD well on my end, I have to maintain 5 machine and its only increasing 😌

Sent from my LG G6 using FastHub

@Jun711
Copy link

Jun711 commented Oct 23, 2017

Just wonder when this fix will be available? thanks

@jetersen
Copy link
Contributor Author

@Jun711 latest release 2.62.1 includes the manuel style fix at least 👍

@Jun711
Copy link

Jun711 commented Oct 23, 2017

@Casz Is manual style fix what @thebugcode suggested?

I got this error with fastlane 2.62.1 without any fix

** EXPORT FAILED **
[12:24:22]: Exit status: 70
[12:24:22]: No provisioning profile provided
[12:24:22]: Make sure to pass a valid provisioning for each required target

@jetersen
Copy link
Contributor Author

@Jun711 Are you using match or sigh?

@Jun711
Copy link

Jun711 commented Oct 23, 2017

@Casz match

lane :certificates do
  sh "ssh-add"
  match(type: "appstore", app_identifier: ["..."], readonly: true)
  match(type: "adhoc", app_identifier: ["..."], readonly: true)
  match(type: "development", app_identifier: ["..."], readonly: true)
end

Will it be enough if I add this to my gym section?

gym(
    export_method: "app-store",
    export_options: {
      provisioningProfiles: { 
        "com.example.bundleid" => "Provisioning Profile Name",
        "com.example.bundleid2" => "Provisioning Profile Name 2"
      }
    }
  )

@jetersen
Copy link
Contributor Author

jetersen commented Oct 23, 2017

match should already expose the certificates, unless you call them separately.

You need to have a lane that calls your certificates lane and calls gym that way match should expose the values to gym 👍

lane :build do
  certificates # calls the certificates lane so match can expose the app ids
  gym(
    export_method: "app-store"
  )
end

@Jun711
Copy link

Jun711 commented Oct 23, 2017

@Casz
What I had in my gym before updating to iOS11 was

gym(
      scheme: "...",
      project: "path/to/project"
    )

After trying what you suggested, match lane ran properly but I got this error instead

ERROR [2017-10-23 13:11:37.99]: fastlane finished with errors
/usr/local/lib/ruby/gems/2.4.0/gems/fastlane-2.62.1/fastlane_core/lib/fastlane_core/ui/interface.rb:131:in `user_error!': [!] Could not find option 'export' in the list of available options: workspace, project, scheme, clean, output_directory, output_name, configuration, silent, codesigning_identity, skip_package_ipa, include_symbols, include_bitcode, export_method, export_options, export_xcargs, skip_build_archive, build_path, archive_path, derived_data_path, result_bundle, buildlog_path, sdk, toolchain, destination, export_team_id, xcargs, xcconfig, suppress_xcode_output, disable_xcpretty, xcpretty_test_format, xcpretty_formatter, xcpretty_report_junit, xcpretty_report_html, xcpretty_report_json, analyze_build_time, xcpretty_utf, skip_profile_detection (FastlaneCore::Interface::FastlaneError)

@jetersen
Copy link
Contributor Author

obviously typo on my end 🗡
export should be export_method

@Jun711
Copy link

Jun711 commented Oct 23, 2017

@Casz yea, I can push to test flight now, thanks!

@acecilia
Copy link

I explain here my situation, so maybe is useful for somebody:

I have automatic signing enabled.
I had a provisioning profile, lets call it "profile.mobileprovision".
I had two signing certificates: certificate "A" and "B".
Certificate "A" was not in my machine.
Certificate "B" was in my machine, together with the private key.
The "profile.mobileprovision" profile was linked with the second certificate "B" (you can see the linked certificates in member center).

I was getting the error because sigh was configured to force = true, and even fastlane was correctly finding the "profile.mobileprovision" profile, it was also recreating it each time, linking it with certificate "A" [note it was linking it with certificate "A" instead of "B"].

When the signing process was happening, xCode was looking for certificate "A" in my machine, it was not finding it and it was failing. Removing force = true in sigh and relinking "profile.mobileprovision" with certificate "B" in the member center fixed the issue.

Note: the -allowProvisioningUpdates worked, but was asking for access to the keychain all the time.

@jetersen
Copy link
Contributor Author

Issue is resolved

@revolter
Copy link
Collaborator

So what's the best solution? Using a plist that you pass to gym?

@jetersen
Copy link
Contributor Author

jetersen commented Nov 21, 2017

if you are not using sigh or match, then passing the plist to gym is the next best.

@jetersen
Copy link
Contributor Author

jetersen commented Nov 21, 2017

This is our current build lane:

  lane :build do |options|
    xcversion version: '~> 9'
    scheme = options[:scheme] || ENV['GYM_SCHEME']
    configuration = options[:configuration] || 'Debug'
    type = options[:type] || 'development'
    app_identifier = options[:app_identifier] || ENV['APP_IDENTIFIER']
    git_branch = options[:git_branch] || ENV['MATCH_GIT_BRANCH']
    export_method = options[:export_method] || 'development'
    if is_jenkins
      setup_jenkins
      configuration = 'Release'
      FileUtils.rm_rf('../output')
      ENV['FL_BUILDLOG_PATH'] = 'fastlane/logs'
      bump_build_number
      app_identifiers = [
        app_identifier,
        "#{app_identifier}.watchkitapp",
        "#{app_identifier}.watchkitapp.watchkitextension"
      ]
      update_project_team
      match(
        type: type,
        readonly: true,
        git_branch: git_branch,
        app_identifier: app_identifiers
      )
      export_method = Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE]
    end
    pods
    xcargs = [
      "APP_IDENTIFIER=#{app_identifier}",
      '-allowProvisioningUpdates',
      options[:xcarg]
    ]
    gym(
      scheme: scheme,
      configuration: configuration,
      xcargs: xcargs.join(' '),
      export_method: export_method
    )
  end

@revolter
Copy link
Collaborator

And if I use sigh then it should work without adding the -allowProvisioningUpdates flag?

@jetersen
Copy link
Contributor Author

@revolter if you disable automatic signing ya.

@anushkmittal
Copy link

anushkmittal commented Dec 27, 2017

I'm using match but facing the same problem. Is it necessary to generate the .plist manually?

Here's my current lane:

  lane :beta do
    slack(message: "Running the beta lane for iOS TestFlight")
    match(type: "appstore")
    gym(scheme: "AppName",
        export_method: "app-store",
        silent: true,
        clean: true,
        export_options: {'signingStyle' => 'manual'})
    slack(message: "Building app completed, now uploading!")
    pilot(distribute_external: true,
        changelog: 'Misc. bug fixes and improvements throughout the app.'
    )
    slack(message: "Successfully distributed a new beta build")
  end

@jetersen
Copy link
Contributor Author

with Match in hand, you should not need to specify export_method or export_options. Match will set the proper options for export

@KrauseFx
Copy link
Member

I'll lock this issue for now as the original problem was resolved - if you're running into the same problem please submit a new issue, so we can help you 👍

@fastlane fastlane locked and limited conversation to collaborators Dec 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests