21

I am working on the application, where it was working in a proper manner. but later I did update the mac to macOS Monterey 12.2.1 and updated my iPhone device to latest 15.2 and Xcode 13.0 and used the latest one 13.2.1. But now the application runs crashes on startup or even after login with but there is which is driving me crazy.

Point is it does not work when building on xcode and it works fine when running from Android studio. So below are my specs that I am working on:

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.2.1 21D62 darwin-x64, locale en-GB)
    • Flutter version 2.8.1 at /Users/username/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (3 months ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/username/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
    • Xcode at /Users/username/Desktop/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.63.2)
    • VS Code at /Users/neosoft/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.51


Image for error on xcode

I have been using the Firebase Firestore as a data store. What can I try next?

6
  • can you delete podfile.lock and pods folder in ios folder, and then you must run (pod cache clean --all & pod install --repo-update) in flutter terminal iOS directory,after that you must run or build again your flutter code. after that feedback to me. Commented Mar 6, 2022 at 20:45
  • I have done that before its seems the problem still remains Commented Mar 7, 2022 at 8:20
  • I had the same issue while back with one of my projects, for my case the application was crashing due to the font being not supported in ios and in an other case the third party package I was using was causing the crash . The crash may be caused by multiple reasons from any one of your packages not supporting the latest version or mismatch in flutter version. when u updated your system. Commented Mar 8, 2022 at 4:42
  • Sorry cannot share the project, Its from on of my clients Commented Mar 9, 2022 at 4:14
  • @MaziarSaadatfar: it's not bad to ask for a public repo, but if the question needs one in order to be understood, it is off-topic and would need to be put on hold. So, it is generally best to help the question author improve the question without that if possible. Commented Mar 9, 2022 at 8:17

8 Answers 8

12

After some reading I found out that in my case it was probably this issue:

https://github.com/flutter/flutter/issues/60657

So I made a workaround for the issue by changing the build scheme to production one in case I need to have a build that works without debugger attached to the running application. (e.g. so my colleagues can test the app)

Step 1: enter image description here

Step 2: enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I use the same technique. - Just run the app in the 'Release' build configuration. - that's it. - it works like a charm.
this works on my case too. the errors show sth related to firebase libs but solve by change to release schema
11

In iOS 14+, debug mode Flutter apps can only be launched from Flutter tooling, IDEs with Flutter plugins or from Xcode.

Alternatively, build in profile or release modes to enable launching from the home screen.

Maybe because the flutter doesn't show you this text, you think it's a mistake

Or maybe rm -rf Podfile.lock then pod install

1 Comment

this comment need raising
10

For the most cases, the final solution for me was always deleting the whole ios folder (make sure to backup the logo, assets, ...), running flutter create -i swift . to recreate the ios folder, and running flutter clean.

Every time I face the error, I did those steps several times in a random order, and it just got solved.

1 Comment

This was the only thing that worked for me, even though it was one of the higher labour solution.
9

Inside iOS > AppDelegate.swift, add the FirebaseApp.configure() method before GeneratedPluginRegistrant.register(with: self)

 FirebaseApp.configure()
 GeneratedPluginRegistrant.register(with: self)

Alternatively:

  1. Run flutter clean
  2. Navigate to the ios folder then delete the pods folder.
  3. From your terminal command cd ios , then run $pod install
  4. Once complete, right-click ios > Open in Xcode.
  5. From the application window top menu bar, click Product > Clean Build Folder
  6. Build the project (Product > Build)
  7. From your project terminal command flutter run

4 Comments

I have error : can not find FirebaseApp in scope
Solution for issue faced by @Kobi - Don't forget to add import Firebase on top if you're putting FirebaseApp.configure().
For the aternative solution mentioned above, run flutter pub get before the 3rd point.
I found the problem, it was request for location permission in the iOS initialization
1

Please take a backup of the project, delete pubSpec.lock, and from inside the ios folder delete 'Podfile.lock', pods directory and Xcworkspace. Then run flutter pub get then navigate to ios folder and run pod install. Then try building it in xcode.

2 Comments

Sorry for the delay did try it but still no luck
In pubspec.yaml for firebase core give version as any, then run flutter pub get. Then try building it from Android studio or vs code directly. You may get better insights of the error.
0

It seems like while building it takes reference from derive data for ios. Follow bellow steps hopefully, this will work

  1. Delete Derive data for ios
  2. Delete podfile.lock
  3. Execute flutter clean to your project terminal
  4. Execute flutter pub get
  5. Move to ios directory and execute pod install

Then try to build from Xcode.

2 Comments

Sorry for the delay i was downgrading the macOS to bigsur so that it might work. But i did try this thing its still not working
Try removing the plugin version of Firebase Firestore or make it any this will download a compatible version of SDK and run it from Flutter code, maybe this will help you!
0

If you are using phone authentication, be aware of that you need to add Encoded App Id from firebase console to Xcode>Targets>Info>Url Scheme

Step1 : Go to Firebase Console > Project Settings > iOS find your iOS apps Encoded App Id Firebase iOS Encoded App Id

Then, copy and paste it Xcode Workspace>Runner>Targets>Runner>Info>Add URL Types>URL Scheme

Xcode Url Scheme

Comments

0

I happened to find that this problem is related to incompatible APIs. What I suggest is to create a new project and add the APIs in pubspec.xml file one by one, compiling each time until the crash happens again. Pay particular attention to the APIs that manipulate images, the admob, google map and the APIs derived from webview

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.