Skip to content

Add2App [Option B] product can't be uploaded to AppStoreConnect #47930

@nailgilaziev

Description

@nailgilaziev

After step by step following the instruction Integrate a Flutter module into your iOS project app is successfully building, running and archiving but in the process of uploading to AppStoreConnect error occurs with message:
Code signing "Flutter.framework" failed.

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-RU)
    • Flutter version 1.12.13+hotfix.5 at /Users/n/Tools/flutter
    • Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/n/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
    • iPhone (Grado) • e9e4908a31af78e6cfd1ff8c7164b51aee8f6459 • ios • iOS 13.3

Steps to reproduce:

cd ~
mkdir pubios
cd pubios
flutter create --template module my_flutter

open xcode and create new project - Single View App (Storyboard based)
I call it host_ios

so file structure currently is next

pubios/
├─my_flutter
└─host_ios

generating flutter app frameworks (note: directly to host_ios folder)

cd my_flutter
flutter build ios-framework --output=../host_ios/embed/

Go to xcode and DO steps described in documentation Option B - Embed frameworks in Xcode

  • Go to settings -> General tab
  • Press app/plus button in section Frameworks, Libraries, and Embedded Content
  • Press buttun Add Other... -> Add Files
  • Navigate to folder ../host_ios/embed/Release/ where frameworks saved
  • Select both App.framework and Flutter.Framework
  • open Build Settings tab and search for Framework Search Paths (FRAMEWORK_SEARCH_PATHS)
  • change hardcoded value from $(PROJECT_DIR)/embed/Releaseto $(PROJECT_DIR)/embed/$(CONFIGURATION)
  • open file ../host_ios/host_ios.xcodeproj/project.pbxproj in some text editing tool
  • replace row path = embed/Release/App.framework;to path = "embed/$(CONFIGURATION)/App.framework";
  • do same for Flutter.Framework
  • save, exit ang go to xcode (your frameworks icons now has some white color in settings)

Open ViewController.swift and replace content with this code

import UIKit
import Flutter

class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let button = UIButton(frame: CGRect(x: 140, y: 200, width: 100, height: 50))
        button.setTitle("run flutter", for: .normal)
        button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)
        self.view.addSubview(button)
    }
    
    lazy var flutterEngine = FlutterEngine(name: "flutter engine for reports")
    var flutterVC:FlutterViewController? = nil
    
    @objc func buttonAction(sender: UIButton!) {
        if flutterVC == nil{
            // Runs the default Dart entrypoint with a default Flutter route.
            // flutterEngine field initialized lazily
            flutterEngine.run();
            flutterVC = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
        }
        present(flutterVC!, animated: true, completion: nil)
    }
}

Run and you should see the integrated to the host ios app default flutter counter app presented after button tap.

Now, lets try to upload this app to appstore connect!
Follow the documentation tutorial Build and release an iOS app

  • I change BundleIdentivier, Version, Build number in General tab
  • And change Signing section in Signing&Capabilities tab to appropriate values (Distribution provisionProfile and Distribution certificate)

Next, archive and upload product to appStore connect!

Code signing "Flutter.framework" failed.
err

Ps
My code signing entitlements is correct. Because if I remove added frameworks I can successfully sign and upload the app to appstore connect.

In Distribution logs I cant find anything that describe error more detailed. All files attached
IDEDistribution.critical.log - Empty file
IDEDistribution.standard.log
IDEDistribution.verbose.log
IDEDistributionPipeline.log
IDEDistributionProvisioning.log - empty file
IDEITunesSoftwareService.log

.../host_ios/embed/Release    ls -l
drwxr-xr-x  5 n  staff  160 Dec 29 00:00 App.framework
drwxr-xr-x  8 n  staff  256 Dec 28 23:59 Flutter.framework

Default new Xcode project comes with Bitcode Enabled true

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: existing-appsIntegration with existing apps via the add-to-app flowc: crashStack traces logged to the consoleplatform-iosiOS applications specificallyt: xcode"xcodebuild" on iOS and general Xcode project management

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions