Skip to content

Flutter couldn't be found in share extension #12834

@mrafieefard

Description

@mrafieefard

Steps to reproduce

I create share extension do what exactly this link said and I get error

Expected results

IOS app should be build without any errors and flutter embedded into share extension

Actual results

Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): Unable to find module dependency: 'Flutter'
import Flutter
^
/Users/mohammad/Projects/MyReels/mobile/ios/ShareExtension/ShareViewController.s
wift:1:7

Code sample

Code sample
import UIKit
import Flutter


class ShareViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        showFlutter()
    }


    func showFlutter() {
        let flutterEngine = FlutterEngine(name: "my flutter engine")
        flutterEngine.run()
        let flutterViewController = FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
        addChild(flutterViewController)
        view.addSubview(flutterViewController.view)
        flutterViewController.view.frame = view.bounds
    }


    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        self.extensionContext?.cancelRequest(
            withError: NSError(domain: Bundle.main.bundleIdentifier!, code: 0))
    }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.35.7, on macOS 15.7.1 24G231 darwin-x64, locale
    en-US) [745ms]
    • Flutter version 3.35.7 on channel stable at /Users/mohammad/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision adc9010625 (8 weeks ago), 2025-10-21 14:16:03 -0400
    • Engine revision 035316565a
    • Dart version 3.9.2
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      no-enable-lldb-debugging

[✗] Android toolchain - develop for Android devices [700ms]
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1) [6.6s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17A400
    • CocoaPods version 1.16.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at
    /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) [19ms]
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (not installed) [18ms]
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/macos-android-setup for detailed
      instructions).

[✓] VS Code (version 1.107.0) [18ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.124.0

[✓] Connected device (3 available) [9.9s]
    • Mohammad (mobile)   • 00008110-00180D993A06201E            • ios        •
      iOS 26.1 23B85
    • iPhone 16e (mobile) • A8F80FB5-BA94-4426-AED7-299D3EAB16CB • ios        •
      com.apple.CoreSimulator.SimRuntime.iOS-26-0 (simulator)
    • macOS (desktop)     • macos                                • darwin-x64 •
      macOS 15.7.1 24G231 darwin-x64

[✓] Network resources [729ms]
    • All expected network resources are available.

! Doctor found issues in 3 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-mediumNecessary but not urgent concern. Resolve when possible.target.iOSTarget apps on the iOS Platform

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions