Flutter shows black screen when launching iOS app - ios

The problem: I get a black screen in my iOS Flutter app after a proper
build (XCode or VSCode or Android Studio), without errors. As soon as
it installs and launches the screen goes to black, with no other sign of life.
The app is generated (I can see the icon on the screen), but as soon I
start the app, it goes completely black.
Setup: (See Flutter doctor below) I´m using Flutter with Firebase
Database in iOS physical device (also in various Simulator types).
Important: The same code for Android is working properly, no black
screen, everything works fine!
I'm pretty sure everything is properly configured in my Firebase
project, I've been checking every detail and, as I say, when
launching to an Android device, everything works fine. For iOS the
file GoogleService-Info.plist is in its place. The configuration of the Signing in XCode also done, and no errors there.
Outputs.-
Flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2
19C57, locale es-ES)
• Flutter version 1.12.13+hotfix.5 at /Users/desarrollo/development/flutter
• Framework revision 27321ebbad (2 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.2)
• Android SDK at /Users/desarrollo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-29, build-tools 29.0.2
• 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)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.1
[✓] Connected device (1 available)
• iPhone 11 Pro Max • C9503E12-9146-452B-93AE-E31DBEA1097E • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• No issues found!
pubspec.yaml (assume correct tabulations):
name: tumeteo_app
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.2.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.4.3+1
firebase_storage: ^3.1.0
firebase_storage_image: ^0.4.0
cloud_firestore: ^0.13.0+1
firebase_auth: ^0.15.3
curved_navigation_bar: ^0.3.1
carousel_pro: ^1.0.0
firebase_messaging: ^6.0.9
rflutter_alert: ^1.0.3
shared_preferences: ^0.5.6
image_cropper: ^1.1.0
image_picker: ^0.6.2+1
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.4
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon3.png"
adaptative_icon_background: "assets/icon/icon3.png"
flutter:
uses-material-design: true
assets:
- assets/images/
fonts:
- family: PermanentMarker
fonts:
- asset: fonts/PermanentMarker-Regular.ttf
- family: BarlowCondensed
fonts:
- asset: fonts/BarlowCondensed-Regular.ttf
- family: Handlee
fonts:
- asset: fonts/Handlee-Regular.ttf
- family: PathwayGothicOne
fonts:
- asset: fonts/PathwayGothicOne-Regular.ttf
- family: RopaSans
fonts:
- asset: fonts/RopaSans-Regular.ttf
Output from XCode Building:
2019-12-27 11:02:51.658802+0100 Runner[11289:50522] -
<AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled.
Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen
name or override the default screen class name. To disable screen
reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean)
in the Info.plist
2019-12-27 11:02:51.981673+0100 Runner[11289:49976]
[VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache,
aborting restore
2019-12-27 11:02:51.984084+0100 Runner[11289:49976] Configuring the
default Firebase app...
2019-12-27 11:02:51.997756+0100 Runner[11289:50520] 6.14.0 -
[Firebase/Core][I-COR000004] App with name __FIRAPP_DEFAULT does not
exist.
2019-12-27 11:02:52.088688+0100 Runner[11289:50521] 6.14.0 -
[Firebase/Analytics][I-ACS023007] Analytics v.60107000 started
2019-12-27 11:02:52.089771+0100 Runner[11289:50521] 6.14.0 -
[Firebase/Analytics][I-ACS023008] To enable debug logging set the
following application argument: -FIRAnalyticsDebugEnabled
2019-12-27 11:02:52.111059+0100 Runner[11289:49976] Configured the
default Firebase app __FIRAPP_DEFAULT.
2019-12-27 11:02:52.226945+0100 Runner[11289:50556] 6.14.0 -
[Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications
proxy enabled, will swizzle remote notification receiver handlers. If
you'd prefer to manually integrate Firebase Messaging, add
"FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to
NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
OUTPUT from VSCode:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Xcode build done. 570,6s
path: satisfied (Path is satisfied), interface: en0
[VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache,
aborting restore
Configuring the default Firebase app...
path: satisfied (Path is satisfied), interface: en0
Configured the default Firebase app __FIRAPP_DEFAULT.
path: satisfied (Path is satisfied), interface: en0
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.

There's a message thrown from the app App with name __FIRAPP_DEFAULT does not exist. - this error commonly appears when Firebase isn't initialized correctly in the Flutter app. Import the packages in the Flutter app's main.dart and initialize Firebase
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
...
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
You can follow this guide for more details.

Related

Module 'flutter_barcode_scanner' not found [Flutter / iOS]

I am trying to run a Flutter app on iOS device after some time but the project is failing to build for iOS.
The error that I am getting is happening in the "GeneratedPluginRegistrant.h" file and is as follows:
#import "GeneratedPluginRegistrant.h"
#if __has_include(<flutter_barcode_scanner/SwiftFlutterBarcodeScannerPlugin.h>)
#import <flutter_barcode_scanner/SwiftFlutterBarcodeScannerPlugin.h>
#else
#import flutter_barcode_scanner; /* ERROR: Module 'flutter_barcode_scanner' not found */
#endif
My pubspec.yaml content are as follows:
name: test_app
description: A new Flutter project.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.17.6 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_speed_dial: ^6.2.0
flutter_barcode_scanner: ^2.0.0
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/playstore_icon.png"
min_sdk_android: 29
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.10.0
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/
- assets/illustrations/
There is no issue with my Flutter as outputted by flutter doctor command as follows:
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.6 21G115 darwin-arm, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.74.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
• No issues found!
To resolve the issue I tried the following commands first:
flutter clean
flutter pub get
But the issue still persisted. Then I used the following steps to resolve the issue:
Step 1: Deleted the iOS folder in the project.
Step 2: Used the commands in terminal as follows -
flutter create -i swift .
flutter clean
flutter pub get
The issue still persisted and the build failed with the same error as above.
Not quite sure now how to resolve this. Can anyone please help?
Thanks in advance!

Flutter error building for iOS "ld: framework not found"

I've been working for a few weeks on a Flutter app which I run on Android and iOS. It worked well until some days ago I upgraded the flutter version and some package dependencies, and it suddenly stopped building for iOS.
There have been multiple issues I have managed to solve, but I can figure out this one. Now, each time I try to build the iOS app I get:
ld: framework not found package_info_plus
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've tried cleaning the project with flutter clean and building again after performing a pub get, but it doesn't solve the issue. I don't depend directly on package_info_plus, but there is one of my packages which does.
I've also tried adding package_info_plus to my pub spec, but then I get the same error again with the package path_provider, which I'm already using.
I have search and try every solution, but nothing works. Could somebody help me?
In case it helps, here you have my pubspec.yaml:
name: app name
description: App description
version: 2.0.0+12
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
shared_preferences: ^2.0.7
provider: ^6.0.0
http: ^0.13.3
device_info: ^2.0.2
progress_state_button: ^1.0.3
uuid: ^3.0.4
universal_platform: ^1.0.0+1
drift: ^1.0.0
sqlcipher_flutter_libs: ^0.5.0
path_provider: ^2.0.3
path: ^1.8.0
flutter_local_notifications: ^9.1.4
flutter_native_timezone: ^2.0.0
progress_dialog: ^1.2.4
url_launcher: ^6.0.10
flutter_slidable: ^1.1.0
tuple: ^2.0.0
get_it: ^7.2.0
local_auth: ^1.1.7
date_util: ^0.1.4
date_picker_timeline: ^1.2.3
intl: ^0.17.0
file_picker_cross: ^4.4.2
share_extend: ^2.0.0
flutter_svg: ^0.22.0
dev_dependencies:
flutter_test:
sdk: flutter
drift_dev: ^1.0.0
build_runner: ^2.0.4
flutter:
uses-material-design: true
And the output of flutter doctor -v:
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale en-ES)
• Flutter version 2.5.3 at /Users/javierd/Android/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (7 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/javierd/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Users/javierd/Downloads/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.1, Build version 13A1030d
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Users/javierd/Downloads/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.10+0-b96-7249189)
[✓] Connected device (3 available)
• iPhone 13 (mobile) • 8957D248-FB8E-4114-A3C1-E5DCF64FD39E • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.0.1
21A559 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome
96.0.4664.55
• No issues found!
Thanks a lot in advance!
for me downgrade the package from the last version

Flutter app does not work on a real iOS device (white screen)

Created a test application flutter create hello_world.
flutter run on the ios simulator launches the application perfect - it works!
But when launched on a real iOS device, appears windows the "Local Network" -> press "allow", and after only white screen.
iOS 14.7.1
Xcode 12.5.1
Signing & Capabilities - no error
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5 20G71 darwin-x64, locale
ru-RU)
• Flutter version 2.2.3 at /Users/incognito/Developer/flutter
• Framework revision f4abaa0735 (4 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 31.0.0)
• Android SDK at /Users/incognito/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• 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)
• All Android licenses accepted.
[✓] 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)
[✓] Connected device (2 available)
• iPhone 12 mini (mobile) • 1CE9DEC7-D645-4C14-A3A5-79C4B1C8AB9F • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 92.0.4515.107
! Error: iPhone No Name is busy: Waiting for Device. Xcode will continue
when iPhone No Name is finished. (code -10)
Xcode console
2021-07-30 01:27:14.959824+0300 Runner[440:12621] Metal API Validation Enabled
2021-07-30 01:27:15.028878+0300 Runner[440:12621] fopen failed for data file: errno = 2 (No such file or directory)
2021-07-30 01:27:15.028922+0300 Runner[440:12621] Errors found! Invalidating cache...
2021-07-30 01:27:15.076411+0300 Runner[440:12621] Warning: Unable to create restoration in progress marker file
2021-07-30 01:27:15.088662+0300 Runner[440:12868] [VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2021-07-30 01:27:15.088704+0300 Runner[440:12868] [VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
2021-07-30 01:27:15.088835+0300 Runner[440:12868] [VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
2021-07-30 01:27:15.088861+0300 Runner[440:12868] [VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
2021-07-30 01:27:15.115109+0300 Runner[440:12882] flutter: Observatory listening on http://127.0.0.1:50825/Ibq99VrylBU=/
UPDATE
footprint for posterit:
Solution - delete the bin/cache directory in your Flutter installation directory, then run flutter doctor and try again.
footprint for posterit: Solution - delete the bin/cache directory in your Flutter installation directory, then run flutter doctor and try again.

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)

iOS app icon not showing up using flutter

I have tried so many ways and fixes but my app icon still not showing up. I'm using flutter and I used the flutter_launcher_icons package but still no use.
Here's my pubspec.yaml dev_depend:
dev_dependencies:
flutter_launcher_icons: "^0.7.3"
flutter_test:
sdk: flutter
and here the config:
flutter_icons:
android: "launcher_icon"
ios: "AppIcon"
image_path_ios: "assets/icon/icon.png"
image_path: "assets/icon/icon.png"
and here's my AppIcon file
This is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.20.0-1.0.pre.118, on Mac OS X 10.15.5 19F101, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[!] IntelliJ IDEA Community Edition (version 2018.2.5)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
This is my Asset Catalog App Icon looks like:
Thanks to #SamiHaddad, I missed setting the AppIcon to Asset Catalog App Icon Set Name in the general section of the Runner file in Xcode. This fixed my issue.
It is worked for me in iOS through manual changes when dependency not worked:-
I have generated app icon which required in manual icon changes through site
(appicon.co)
There I got zip file of Image in which I found a folder Assets.xcassets
after extracting the zip file
I found Appicon.appiconset inside the folder Assets.xcassets
I replaced that Appicon.appiconset folder to
iOS/runner/Assets.xcassets/Appicon.appiconset folder
Flutter pub get
Flutter Run

Resources