Fix Fastlane app identifier problem

May 14, 2020

FastLane deliver requires platform for MacOS projects

Fastlane for MacOs projects behave differently from iOS projects. When using fastlane deliver download_metadata command, Fastlane will complain with the following output:

āÆ fastlane deliver download_metadata
[āœ”] šŸš€
[14:35:36]: Login to App Store Connect (me@user.com)
Available session is not valid any more. Continuing with normal login.
[14:35:40]: Login successful

[!] Could not find app with app identifier 'com.your.bundleid' in your App Store Connect account (me@user.com - Team: #####)

Most likely you may have mistyped your app identifier. But if you have triple checked everything. Maybe the problem lies some where else.

Fastlane requires a platform parameter in order to work for MacOs projects. Thus, the right command to execute fastlane deliver is:

> fastlane deliver download_metadata -j osx

The -j flag is an optional parameter to add the platform. By telling Fastlane, it will be able to detect your app identifier.

The deliver section in your FastFile requires a platform too. Take for example this deliver snippet recommended in fastlane deliver documentation.

deliver(
  submit_for_review: true,
  force: true,
  metadata_path: "./metadata"
)

Which will lead to the same error - Could not find app with app identifier....

The fix is to add the platform parameter as shown below.

deliver(
  platform: "osx",
  submit_for_review: true,
  force: true,
  metadata_path: "./metadata"
)

Why does this happen?

Fastlane relies on a subproject call Spaceship. Spaceship is responsible for integration with AppStoreConnect.

The method that Spaceship uses to find app identifers is:

# @return (Spaceship::Tunes::Application) Returns the application matching the parameter
#   as either the App ID or the bundle identifier
def find(identifier, mac: false)
  all.find do |app|
    ((app.apple_id && app.apple_id.casecmp(identifier.to_s) == 0) || (app.bundle_id && app.bundle_id.casecmp(identifier.to_s) == 0)) &&
    app.version_sets.any? { |v| (mac ? ["osx"] : ["ios", "appletvos"]).include?(v.platform) }
  end
end

Source taken from https://github.com/fastlane/fastlane/blob/master/spaceship/lib/spaceship/tunes/application.rb

The find method defaults a mac flag to false ( line 3 ). Spaceship will further filter out the App identifers based on platform ( line 6 ).

Without supplying a mac flag, Spaceship will only filter 'iOS' and 'appletvos' platforms.

Closing

If you have a MacOS project, and Fastlane is not being nice, try adding a platform parameter. Hopefully that does the trick.

Resources

Fastlane spaceship file :

Related issues on similar topic:


Webmentions

Want to respond? Reply, like, reply or bookmark on Twitter :)

0 Likes