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

feat: shorebird release ios-alpha fails when 'Automatically manage signing' off #1067

Closed
1 task
ben-yolabs opened this issue Aug 8, 2023 · 12 comments · Fixed by #1267
Closed
1 task

feat: shorebird release ios-alpha fails when 'Automatically manage signing' off #1067

ben-yolabs opened this issue Aug 8, 2023 · 12 comments · Fixed by #1267
Assignees

Comments

@ben-yolabs
Copy link

Description

Steps to Reproduce
  1. In an project configured to use Shorebird, turn off Automatically manage signing for the Runner target's Signing & Capabilities in Runner.xcodeproj.
  2. Run shorebird release ios-alpha.

Expected result: The release is created.

Actual result: The release cannot be created.

Output

[WARN] iOS support is alpha. See https://docs.shorebird.dev/status#ios-alpha for more information.
[HTTP] GET https://api.shorebird.dev/api/v1/apps
✓ Fetching apps (0.2s)
[Process.run] /Users/[redacted]/.shorebird/bin/cache/flutter/0e2d280277cf9f60f7ba802a59f9fd187ffdd050/bin/flutter build ipa --release --export-options-plist=/var/folders/r8/txtblszs2b7c67rhw8fbj8zm0000gq/T/X7Trep/ExportOptions.plist
✗ Failed to build IPA (100.1s)
    "Runner.app" requires a provisioning profile with the Associated Domains and Push Notifications features.

Root Cause

The ExportOptions.plist file contains this key-value pair which is incompatible with the pbxproj project configuration for Runner of CODE_SIGN_STYLE = Manual.

  <key>signingStyle</key>
  <string>automatic</string>

Requirements

  • Emit a proper value for the signingStyle entry in the generated ExportOptions.plist by inspecting the value of CODE_SIGN_STYLE for the Runner target

There may be other approaches, such as omitting the entry altogether as flutter build ios does by default.

@bryanoltman bryanoltman moved this to Backlog in Adoption Blockers Aug 8, 2023
@bryanoltman bryanoltman moved this from Backlog to Todo in Adoption Blockers Aug 8, 2023
@bryanoltman
Copy link
Contributor

I'm seeing something similar to your error output when running flutter build ipa without an exportoptions.plist specified. How do you normally distribute to the app store?

@bryanoltman bryanoltman self-assigned this Aug 9, 2023
@ben-yolabs
Copy link
Author

@bryanoltman Here's the exact flutter build ipa command we run in our CD pipeline

flutter build ipa --build-name 2.20230811 --build-number 2.20230811.0 --release --obfuscate --split-debug-info="build/app/outputs/symbols"

@bryanoltman bryanoltman moved this from Todo to In Progress in Adoption Blockers Aug 15, 2023
@bryanoltman
Copy link
Contributor

Hmm, I've set up a new project and configured certs and provisioning profiles, but when I run that command, I get the following output/error:

$ flutter build ipa --build-name 2.20230811 --build-number 2.20230811.0 --release --obfuscate --split-debug-info="build/app/outputs/symbols"


Archiving com.shorebird.timeShift...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6V53YACS2W
Running Xcode build...
 └─Compiling, linking and signing...                      2,656ms
Xcode archive done.                                         23.3s
Built /Users/bryanoltman/Documents/sandbox/ios_signing/build/ios/archive/Runner.xcarchive.

[✓] App Settings Validation
    • Version Number: 2.20230811.0
    • Build Number: 2.20230811.0
    • Display Name: Ios Signing
    • Deployment Target: 11.0
    • Bundle Identifier: com.shorebird.timeShift

[!] App Icon and Launch Image Assets Validation
    ! App icon is set to the default placeholder icon. Replace with unique icons.
    ! Launch image is set to the default placeholder icon. Replace with unique launch image.

To update the settings, please refer to https://docs.flutter.dev/deployment/ios

Building App Store IPA...                                           6.1s
Encountered error while creating the IPA:
error: exportArchive: "Runner.app" requires a provisioning profile.


Try distributing the app in Xcode: "open
/Users/bryanoltman/Documents/sandbox/ios_signing/build/ios/archive/Runner.xcarchive"

Is there some local configuration that I'm still needing to do?

@bryanoltman bryanoltman moved this from In Progress to Todo in Adoption Blockers Aug 15, 2023
@bryanoltman
Copy link
Contributor

@ben-yolabs following up. We'd love to support your use case!

@bryanoltman bryanoltman removed their assignment Aug 21, 2023
@joeeasy
Copy link

joeeasy commented Aug 25, 2023

Hi @ben-yolabs,

Provided that you already have the required certificates and profiles to sign the IPA, we will proceed with the flutter build ipa command.

Replace your flutter build command with shorebird release ios-alpha --flavor staging -- --export-options-plist ./ios/export.plist -v , When you are building with shorebird you'll have to create an exportOptions.plist file for staging and production (or the name of your flavor). This should be in the root directory of your ios folder.

Now your exportOptions.plist file should look like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>signingStyle</key>
    <string>manual</string>

    <key>method</key>
    <string>ad-hoc</string>

    <key>provisioningProfiles</key>
    <dict>
        <key>com.example.staging</key>
        <string>match AdHoc com.example.staging</string>

        <key>com.apple.developer.associated-domains</key>
        <string>match AdHoccom.example.staging</string>

        <key>aps-environment</key>
        <string>match AdHoc com.example.staging</string>
    </dict>
</dict>
</plist>

If you are wondering where to get the information to add for your exportOption.plist file, check your fastfile for something like this

export_options: {
        signingStyle: "manual",
        method: "ad-hoc",
        provisioningProfiles: {
          "com.example.staging" => "match AdHoc com.example.staging",
          "com.apple.developer.associated-domains" => "match AdHoc com.example.staging",
          "aps-environment" => "match AdHoc com.example.staging"
        }
      }

When the build is complete, the next step would be to upload to testflight, all you have to do is add the ipa path.

lane :beta do
    setup_ci
     app_store_connect_api_key(
        is_key_content_base64: true,
      )

     match(
        type: 'appstore',
        git_url: 'links to certificates',
        git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
        app_identifier: ["com.example.staging"]
     )
    upload_to_testflight(
     ipa: “../build/ios/ipa/example.ipa”
    )

    clean_build_artifacts
  end

I hope this helps

@bryanoltman
Copy link
Contributor

@Fudal You mentioned in #1164 that you were having a similar issue. Can you describe your typical, non-shorebird release process? Which Flutter commands do you run?

@Fudal
Copy link

Fudal commented Aug 27, 2023

@bryanoltman
I'm doing that:
fvm flutter build ios --release --dart-define-from-file=my_config.json
after that I run Xcode and click: product -> archive
after archive I click windows -> organizer
and upload my archive to app store. In the meantime, choosing manual signing and selecting a profile from the list. Then more clicks until the file is uploaded to the AppStore.

@Fudal
Copy link

Fudal commented Aug 28, 2023

@bryanoltman
I've created export.plist file and run:
shorebird release ios-alpha -- --export-options-plist ios/export.plist

and everything works great!

@Fudal
Copy link

Fudal commented Aug 28, 2023

It's great that I was able to build an iOS app this way and publish it, but I'm having a huge problem. I've noticed a huge decrease in the application's performance in places where it downloads data from the Internet (although I'm not sure if it's only there).

The application works instantly when I build it in the previous way (without shorebird), but in the way described above (in the previous post) the application is difficult to use.

@eseidel
Copy link
Contributor

eseidel commented Aug 28, 2023

Performance changes are likely expected during the Alpha release of code push for iOS: https://docs.shorebird.dev/status.

@eseidel eseidel added this to 1.0 Aug 28, 2023
@eseidel eseidel moved this to Customers in 1.0 Aug 28, 2023
@eseidel eseidel moved this from Todo to Punted in Adoption Blockers Aug 28, 2023
@bryanoltman
Copy link
Contributor

@ben-yolabs did @joeeasy's answer help? If so, I'd love to update our docs to explain how to handle this use case

@bryanoltman bryanoltman moved this from Customers to Pending Customer Reply in 1.0 Aug 31, 2023
@bryanoltman bryanoltman moved this from Pending Customer Reply to In Progress in 1.0 Sep 14, 2023
@bryanoltman bryanoltman self-assigned this Sep 14, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 1.0 Sep 15, 2023
@eseidel
Copy link
Contributor

eseidel commented Feb 19, 2024

Just got another report of this on Discord:
https://discord.com/channels/1030243211995791380/1125516353370075306/1209227664783708250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Status: Punted
Development

Successfully merging a pull request may close this issue.

5 participants