skip to Main Content

I am trying to run my flutter app, which uses firebase, in the iOS simulator on my Apple Silicon Mac, but it is not working.
flutter run throws the following error, but flutter build ios works without error. Does anyone have a similar problem and can help me? I have already tried the following things (unfortunately without success):

https://github.com/FirebaseExtended/flutterfire/issues/1979#issuecomment-590173571

https://github.com/FirebaseExtended/flutterfire/issues/1944

Flutter on IOS: fatal error: module 'cloud_firestore' not found

https://bleepcoder.com/flutterfire/562990746/cloud-firestore-fatal-error-module-cloud-firestore-not-found

Here is my terminal output (for flutter run):

flutter run
Multiple devices found:
sdk gphone arm64 (mobile)  • emulator-5554                        • android-arm64 • Android 11 (API 30) (emulator)
iPhone 13 Pro Max (mobile) • ABCD • ios           • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
[1]: sdk gphone arm64 (emulator-5554)
[2]: iPhone 13 Pro Max (ABCD)
Please choose one (To quit, press "q/Q"): 2
Launching lib/main.dart on iPhone 13 Pro Max in debug mode...
Running pod install...                                              8,7s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                      2.778ms
Xcode build done.                                           18,1s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[10675]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x2023af678) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1042402c8). One of the two will be used. Which one is
    undefined.
    objc[10675]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x2023af6c8) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104240318). One of the two will be used. Which one is
    undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/XXXX/Development/recipe_vault_fl/ios/Pods/AppAuth/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m:148:42: warning: 'openURL:' is
    deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
          [[UIApplication sharedApplication] openURL:_appStoreURL];
                                             ^~~~~~~
                                             openURL:options:completionHandler:
    In module 'UIKit' imported from /Users/XXXX/Development/recipe_vault_fl/ios/Pods/Target Support Files/AppAuth/AppAuth-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/UIKit.fram
    ework/Headers/UIApplication.h:124:1: note: 'openURL:' has been explicitly marked deprecated here
    - (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0, 10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    /Users/XXXX/Development/recipe_vault_fl/ios/Pods/AppAuth/Source/AppAuth/iOS/OIDExternalUserAgentIOSCustomBrowser.m:156:61: warning: 'openURL:' is
    deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
      BOOL openedInBrowser = [[UIApplication sharedApplication] openURL:requestURL];
                                                                ^~~~~~~
                                                                openURL:options:completionHandler:
    In module 'UIKit' imported from /Users/XXXX/Development/recipe_vault_fl/ios/Pods/Target Support Files/AppAuth/AppAuth-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/UIKit.fram
    ework/Headers/UIApplication.h:124:1: note: 'openURL:' has been explicitly marked deprecated here
    - (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0, 10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    2 warnings generated.
    /Users/XXXX/Development/recipe_vault_fl/ios/Pods/AppAuth/Source/AppAuth/iOS/OIDExternalUserAgentIOS.m:168:58: warning: 'openURL:' is deprecated: first
    deprecated in iOS 10.0 [-Wdeprecated-declarations]
        openedUserAgent = [[UIApplication sharedApplication] openURL:requestURL];
                                                             ^~~~~~~
                                                             openURL:options:completionHandler:
    In module 'UIKit' imported from /Users/XXXX/Development/recipe_vault_fl/ios/Pods/Target Support Files/AppAuth/AppAuth-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/UIKit.fram
    ework/Headers/UIApplication.h:124:1: note: 'openURL:' has been explicitly marked deprecated here
    - (BOOL)openURL:(NSURL*)url API_DEPRECATED_WITH_REPLACEMENT("openURL:options:completionHandler:", ios(2.0, 10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    1 warning generated.
    /Users/XXXX/Development/recipe_vault_fl/ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'cloud_firestore' not found
    @import cloud_firestore;
     ~~~~~~~^~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

Could not build the application for the simulator.
Error launching application on iPhone 13 Pro Max.

Here is my terminal output (for flutter build ios):

flutter build ios
Running "flutter pub get" in recipe_vault_fl...                  1.910ms
Building XX.XXXXXXXX.XXXXXXXXXXXXX for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXXXXX
Running pod install...                                             11,2s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         9,1s
Xcode build done.                                           134,6s
Built /Users/XXXX/Development/recipe_vault_fl/build/ios/iphoneos/Runner.app.

Edit:
Here ist my AppDelegate.swift file:

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

I don’t know if necessary, but here is my pubspec.yaml file too:

name: recipe_vault_fl
description: Manage your recipes and grocery lists easily.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  cloud_firestore: ^3.1.8
  cupertino_icons: ^1.0.2
  dropdown_button2: ^1.1.1
  email_validator: ^2.0.1
  equatable: ^2.0.3
  firebase_auth: ^3.3.7
  firebase_core: ^1.12.0
  flutter:
    sdk: flutter
  flutter_bloc: ^8.0.1
  flutter_material_pickers: ^3.1.2
  flutter_reorderable_list: ^1.1.0
  flutter_slidable: ^1.1.0
  flutterfire_ui: ^0.3.4
  page_transition: ^2.0.4
  uuid: ^3.0.5

dev_dependencies:
  flutter_lints: ^1.0.0
  flutter_test:
    sdk: flutter

2

Answers


  1. Try those steps;

    cd ios

    pod deintegrate

    pod install

    cd ..

    flutter clean

    flutter build ios

    flutter run

    If it’s not work then share your ios/Runner/AppDelegate.swift file please

    Login or Signup to reply.
  2. Try running your Xcode first and make sure that it’s up-to-date. Open the {flutter_project}/ios build on Xcode then try to run the iOS project on the Simulator from there.

    If you’re still having issues, you can run this command on your Terminal. This usually resolves issues running Flutter iOS builds on the simulator and should set the path for the active developer directory.

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search