I try to add a native Splash Screen to my Flutter iOS App with this tutorial:
https://medium.com/@obenkucuk/flutter-native-splash-animation-with-lottie-on-ios-3c8660b41dde
I added to AppDelegate:
// Runs the default Dart entrypoint with a default Flutter route.
flutterEngine.run()
// Used to connect plugins (only if you have plugins with iOS platform code).
GeneratedPluginRegistrant.register(with: self.flutterEngine)
and my SplashViewController looks like:
import UIKit
import Lottie
import Flutter
public class SplashViewController: UIViewController {
private var animationView: LottieAnimationView?
public override func viewDidAppear(_ animated: Bool) {
animationView = .init(name: "splash")
animationView!.frame = view.bounds
animationView!.contentMode = .scaleAspectFill
animationView!.loopMode = .playOnce
animationView!.animationSpeed = 1.00
view.addSubview(animationView!)
animationView!.play{ (finished) in
self.startFlutterApp()
}
}
func startFlutterApp() {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let flutterEngine = appDelegate.flutterEngine
let flutterViewController =
FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
flutterViewController.modalPresentationStyle = .custom
flutterViewController.modalTransitionStyle = .crossDissolve
present(flutterViewController, animated: true, completion: nil)
}
}
It is working but I have one Problem if I try to send a mail with the package flutter_email_sender
. This error seems to be a problem with MFMailComposeViewController
:
Attempt to present <MFMailComposeViewController: 0x1508ed800> on <Runner.SplashViewController: 0x147f131c0> (from <Runner.SplashViewController: 0x147f131c0>) which is already presenting <FlutterViewController: 0x14a25f800>.
This solution is not helping me:
/a/59336348/3037763
How could I modify my controller to work with MFMailComposeViewController as well?