flutter: cannot build ios (xcode issues, pod issues?) - ios

Steps to Reproduce
Simply trying to publish my app to ios store. Already available on Play store.
I cannot archive in Xcode, constantly running into issues. Currently have these issues when attempting to archive:
When attempting to run pod install in the ios directory, I continue to get this warning (which according to my research seems to be more of an error):
I tried following everything in this very long thread thread to resolve this issue, but nothing has worked.
I was able to remove another warning by uncommenting line #2 in the Podfile, platform :ios, '9.0'.
I have tried closing Xcode while making changes, and have tried restarting my computer.
I can flutter run and the app will work correctly on my iPhone when it is connected to my macbook.
Other threads from which I've tried everything:
https://github.com/flutter/flutter/issues/42974
https://github.com/flutter/flutter/issues/20685
https://github.com/flutter/flutter/issues/48103
https://github.com/X-Wei/flutter_catalog/issues/26
https://github.com/flutter/flutter/issues/28870
Expected results:
I can successfully archive in Xcode.
Actual results:
Flutter doctor seems to indicate everything is fine, but I continue to get this errors when trying to archive.
AdministorsMBP4:mem_plus_plus matt$ flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.12.13+hotfix.5 at /Users/matt/development/flutter
• Framework revision 27321ebbad (9 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 29.0.1)
• Android SDK at /Users/matt/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.1, Build version 11A1027
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] IntelliJ IDEA Community Edition (version 2019.2.4)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] Connected device (1 available)
• Takkeezi’s iPhone • {redacted} • ios • iOS 12.4.4

Try to this.
flutter clean
pod install
build project
Check a pods module
Pod file

Related

Flutter Firebase app runs fine in simulator but crashes when tested in testflight

Recently I've joined a project of a flutter app using firebase, and everything was fine until it comes to make the production builds. For Android it works fine. But for ios I'm facing a problem that in the simulator it runs without a problem but when I uploaded it to Testflight for my coworkers to test it immediately crashes when opened.
That's my flutter doctor -v:
[✓] Flutter (Channel unknown, 2.2.2, on macOS 11.2.3 20D91 darwin-x64, locale
pt-BR)
• Flutter version 2.2.2 at /Users/leonardofelix/flutter
• Framework revision d79295af24 (4 months ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/leonardofelix/Library/Android/sdk
• Platform android-30, build-tools 30.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_242-release-1644-b3-6915495)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.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
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.61.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 94BE45CC-ED04-4892-B3A6-3F43D0A147AD • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 94.0.4606.81
And the crash report that a tester of testflight sent to me:
crashlog.crash
I've already tested some things that I found googling, like add the Google-Services.plist again using xcode and verified if the schemas to the archive were pointing to release mode. But none of them worked.
If any additional data is needed, I'll be glad to provide. So thanks in advance for any help.
Well, I found the error. I had changed the Flutter version using git (thus, the Flutter folder is a git repository). When I changed the version, it left the cache from the other Flutter version, and that cache was causing the problem.
One thing that helped me to find this out was running the release build in a physical device using Xcode; there it prompt me the following error:
Error while initializing the Dart VM: Wrong full snapshot version, expected '9cf77f4405212c45daf608e1cd646852' found 'e4a09dbf2bb120fe4674e0576617a0dc'
And for that, I found a solution on the web. What I did was to remove the folder cache inside <yourFlutterDir>/bin and run the following commands in the Flutter directory:
git reset --hard
git clean -xffd
flutter doctor
And then, I went to my Flutter project folder, ran flutter clean, and finally flutter build ios.
So the project built successfully, and the app worked in iOS.

iOS flutter app not running after updating device to iOS 14.7.1

After updating my iPhone 11 to iOS version 14.7.1, my flutter app is not launching anymore.
Steps already performed:
flutter clean
flutter pub get
flutter run
Also,
uninstalled and reinstalled the app
restarted the phone
output:
(base) Henrys-MacBook-Air:flutter henrycorreia$ flutter run
Running "flutter pub get" in flutter... 3.2s
Launching lib/main.dart on Henry’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXXXXX
Running pod install... 25.0s
Running Xcode build...
Xcode build done. 208.8s
Installing and launching... 58.4s
Error launching application on Henry’s iPhone.
==>> flutter doctor -v:
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.1 20G80 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/henrycorreia/fvm/versions/2.2.3
• Framework revision f4abaa0735 (6 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/henr/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• 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.8+10-b944.6916264)
[✓] VS Code (version 1.59.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (3 available)
• Moto E 4 Plus (mobile) • xxxxxxxxx • android-arm • Android 7.1.1 (API 25)
• Henry’s iPhone (mobile) • xxxxxxxxxxxxxx • ios • iOS 14.7.1
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.131
! Doctor found issues in 1 category.
Is anybody facing the same issue? Any idea how to fix this?
Thank you
You have runtime error just before your first screen renders, try putting breakpoint in the first line of the main and debug line by line.
I was able to fix the issue. It seems to be a random issue that happens time to time when updating either the flutter version or iOS...
Here's how I fixed the issue:
==>> you can also get inspired by this thread: https://github.com/flutter/flutter/issues/72161
However, what worked for me was very simple as I am using vs code:
uninstalled the app
restarted the phone
open the app using Xcode
Product -> Clean Build Folder
Product -> Run
The app will launch correctly, then quit Xcode
After that, I run the app using vs code, and now it works as before.

White Screen with Flutter: Rejected by Apple's App Review

I am receiving this message with a rejection when I submit my app for review on the App Store:
"Specifically, your app displayed a white, blank screen when we launched your app."
When I test the app on device, everything appears to be working fine. I have tried the following to test:
flutter build ios
flutter run
flutter build ios --release
flutter run
Test with VSCode's run feature.
Run in xcode onto physical device both in Debug and Release schema settings
If I archive, and upload the same build to Testflight, the app can be installed and ran without issue on several different devices.
While all of these methods work on my physical iphone, when I run
flutter build ios --release
open xcode
archive
upload with Organizer in xcode
The app is rejected by Apple. I searched around and found nothing that solves my issues. Any suggestions or good next steps?
flutter doctor:
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.1 20C69 darwin-x64, locale en-US)
• Flutter version 1.22.6 at /Users/matthewkrager/flutter
• Framework revision 9b2d32b605 (5 days ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/matthewkrager/Library/Android/sdk
• Platform android-30, build-tools 30.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_242-release-1644-b3-6915495)
✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.9.1
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.18.1
[✓] Connected device (2 available)

Cocoapods seems to install wrong pod version

Cocoapods seems to install a wrong pod version.
Here is an example line from my pubspec.yaml:
webview_flutter: ^1.0.7
When running pod install, this is what I see:
Installing webview_flutter (0.0.1)
In my flutter/.pub_cache/hosted/pub.dartlang.org/ I see the only the following versions:
webview_flutter-0.3.24
webview_flutter-1.0.7
When building with XCode, I get a few warnings from webview_flutter that point to the correct 1.0.7 version, so it seems the right pod is being used despite the cocoapods output. However, this is really confusing. Any thoughts how to solve this would be greatly appreciated.
I have tried re-installing cocoapods, deintegrating pods and building again, cleaning, updating pod repo, deleted Podfile.lock etc usual suspects.
Here's my environment:
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-FI)
• Flutter version 1.22.5 at /Users/ilonamooney/Documents/dev/flutter
• Framework revision 7891006299 (10 days ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/ilonamooney/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/ilonamooney/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Connected device (1 available)
• Ilona’s iPhone (mobile) • a12e6e165529c7307dfdb723f37e02f3901f17d0 • ios • iOS 14.2```

Flutter - Failed to build iOS app on Android Studio

I'm using Flutter with Android-Studio, everything was working great (i.e. compiling and deploying to iOS simulators except until I installed Fastlane Tools. The building process now is broken somehow! I'm not sure if it's from Fastlane or something else though, but now I'm stuck and cannot deploy to iOS anymore.
Steps taken/tried already:
Removing XCode & CommandLineTools (using this post: Complete removal old XCode)
Reinstalling XCode 9.2 (from AppStore)
Reinstalling CommandLineTools for XCode 9.2 (dl from developer tools page)
Reinstalling/updating ios-deply using:
npm install -g ios-deploy --unsafe-perm=true
Error log is on PasteBin to reduce post size:
https://pastebin.com/HQdJYLBr
Flutter doctor report:
[✓] Flutter (on Mac OS X 10.13.3 17D102, locale en-AE, channel alpha)
• Flutter version 0.0.22-pre.1 at /Users/user999/github/flutter
• Framework revision 553fc4264e (3 weeks ago), 2018-03-01 09:30:25 -0800
• Engine revision 6921873c71
• Tools Dart version 2.0.0-dev.16.0
• Engine Dart version 2.0.0-edge.da1f52592ef73fe3afa485385cb995b9aec0181a
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/user999/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.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_152-release-915-b08)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] IntelliJ IDEA Community Edition (version 2017.3.4)
• Flutter plugin version 21.2.3
• Dart plugin version 173.4548.30
[✓] Connected devices
• iPhone X • 2AD97E20-6FB5-4086-BDC0-EBE6138FBD79 • ios • iOS 11.2 (simulator)
Any suggestions, please?
This answer is for the ones who are still trying to work with Xcode 9.2. Starting April, 2020, all apps submitted to the App Store will need to be built with Xcode 11. So don't try to build your Flutter IOS App with XCode 9.2.
Flutter is also changing rapidly therefore, it is better to use the latest XCode version to avoid any deprecated API issue.
For reference visit:
https://github.com/firebase/firebase-ios-sdk/issues/4125

Resources