-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallywaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Description
Objective
Create an iOS framework that uses the Flutter Add To App feature so that it can be added to other apps without adding the Flutter SDK By hand
Problems
So far I have done the following:
- Created a new framework
- Directly used the
podhelper.rbmodified in the Podfile so that I know what pods are imported and what is being done - Solved conflicts in the
podsecfiles for theFlutter``engineand theFlutterPluginRegistrant - Added a convenience class to the framework that can initialize an engine and displays the correct
UIViewController
import Foundation
import Flutter
open class FlutterFramework {
public static let shared = FlutterFramework()
private init(){}
var engine : FlutterEngine?
open func initializeFlutterEngine() {
engine = FlutterEngine(name: "io.flutter", project: nil);
engine?.run(withEntrypoint: nil);
}
open func presentFirstViewControllerOn(_ viewController:UIViewController) {
let vc : ViewController = ViewController()
viewController.present(vc, animated:true, completion:nil)
}
}class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(type:UIButton.ButtonType.custom)
button.addTarget(self, action: #selector(handleButtonAction), for: .touchUpInside)
button.setTitle("Press me", for: UIControl.State.normal)
button.frame = CGRect(x: 80.0, y: 210.0, width: 160.0, height: 40.0)
button.backgroundColor = UIColor.blue
self.view.addSubview(button)
}
@objc func handleButtonAction() {
let flutterViewController = FlutterViewController(engine: FlutterFramework.shared.engine, nibName: nil, bundle: nil)!;
self.present(flutterViewController, animated: false, completion: nil)
}
}- Used the
initializeFlutterEngine()in the application'sAppDelegateto initialize the Flutter engine.
When doing so, the following occurs:
2019-07-11 14:01:11.895325+0100 flutter_ios_host[50001:2161925] [VERBOSE-2:engine.cc(115)] Engine run configuration was invalid.
2019-07-11 14:01:11.895555+0100 flutter_ios_host[50001:2161925] [VERBOSE-2:FlutterEngine.mm(304)] Could not launch engine with configuration.
So my question is: is it possible to start a FlutterEngine without making the changes suggested to AppDelegate in the add to app page ? This functionality is woking in the Android counterpart.
Also, how can we bundle this framework and use it in a computer without Flutter?
If my understanding is correct, we are using a script inside the FLUTTER_ROOT folder, that might not be available in other computer, so how can we proceed? Can this script be bundled with the framework and called there?
fedecastelli
Metadata
Metadata
Assignees
Labels
a: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallywaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds