-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Use initWithEngine:nibName:bundle: method to create FlutterViewController, and then setInitialRoute not working #27216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@x-liang |
https://github.com/X-Liang/NativeWithFlutter This is Demo link |
Look like : #23736 |
你好,你的这个问题解决了吗? |
I have the same problem
|
@lupeihong if it's the same problem, why did you create another issue? #27882 |
Same problem. But weird, use So what's different between ps: |
@ungacy |
I use Swift, and i found problem is |
This comment has been minimized.
This comment has been minimized.
@YoungJam |
I solved the problem. @interface XXFlutterViewController : FlutterViewController (void)viewDidLoad { [GeneratedPluginRegistrant registerWithRegistry:flutterEngine]; //open flutter vc |
1 similar comment
I solved the problem. @interface XXFlutterViewController : FlutterViewController (void)viewDidLoad { [GeneratedPluginRegistrant registerWithRegistry:flutterEngine]; //open flutter vc |
it works on me @kidzss |
Didn't U find the flutterVC dont release in this way? |
I am still experiencing this issue on iOS platform, with the Flutter version shown below : // --------- flutter doctor summary --------- // Doctor summary (to see all details, run flutter doctor -v): // --------- flutter doctor summary --------- // I am following the official guide on https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps. SetInitialRoute() is working when using FlutterViewController(project: nil, nibName: nil, bundle: nil), however, this seems make the Flutter plugins not found with the FlutterViewController, when I try to access methods in Flutter plugins, it throws MissingPluginException. It seems that because of those Plugins are register with FlutterEngine, the FlutterViewController will not find them if not connected with the FlutterEngine. Using FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil), makes the plugins work, but SetInitialRoute() is not working. Is there any way or alternative to solve this issue, making both setInitialRoute and plugins work in the same FlutterViewController? Thanks! |
I meet the problem... almost nothing released... |
|
|
i use the same solution and it fixed.But official should also give a solution. |
I update 1.2.1 last week. Do you mean, at 1.2.1 version, this solution will release memory normally? I used this before and found memory increased linearly. I'll try 1.2.1 and test it. |
WVFlutterViewController *controller = [[WVFlutterViewController alloc] init]; 使用这种方式可以成功传递route,并且不会影响插件的注册 |
the same Problem! |
这个方式有效果,感谢。 |
|
Creating a new FlutterViewController in the new or alloc init way does deliver routeName, but this way creates multiple flutter.io/gpu/ui threads over and over again. |
i have the same question, have you solved it, please? |
When you create a FlutterViewController don't use FlutterEngine let flutterViewController = FlutterViewController(nibName: nil, bundle: nil)
flutterVC.setInitialRoute("RouteName") Use this way is working! |
I use my env is :
|
try to set a view to property |
tks,I am so tried,push animation is not normal |
|
tks, I am also try so, push animation firsh show white splashScreenView, I need to avoid show splashScreen. |
我搞定了,可以传入routeName,又能保证交互好用。it work well let flutterViewController = FlutterViewController.init(project: nil , nibName: nil, bundle: nil)!; |
Use [FlutterViewController new] replace [[FlutterViewController alloc] initWithEngine:flutterEngine nibName:nil bundle:nil] cause other problems。 I have two problems encountered now.
|
yes ,splashScreenView cannot be ignored. Use my code flutter plugin can work normal. Do you try other plugin?for example flutter share_preference
| |
自己
|
|
邮箱:zyg1982527@126.com
|
签名由 网易邮箱大师 定制
On 11/04/2019 11:31, Stellar wrote:
Use [FlutterViewController new] replace [[FlutterViewController alloc] initWithEngine:flutterEngine nibName:nil bundle:nil] cause other problems。 I have two problems encountered now.
Can't avoid show splashScreenView
Case package_info not normal work。 (Suspected that the native and Flutter could not communicate properly)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@zyg1982527 Should be caused by plugin registration issues, use |
仔细研究了下Flutter/Engine里面的源码, 贴一个简单的思路,新建一个FlutterViewController的子类CSFlutterController,去除和launch有关的部分。
|
Yes, it woks for me. You saved my 2 days time, thanks a lot. 亲们,这个法子真的可以啊,[GeneratedPluginRegistrant registerWithRegistry:controller]; 而不是[GeneratedPluginRegistrant registerWithRegistry:self.engine]; |
哈哈,能帮到大家我很开心
| |
自己
|
|
邮箱:zyg1982527@126.com
|
签名由 网易邮箱大师 定制
On 11/19/2019 19:30, amazingrace wrote:
WVFlutterViewController *controller = [[WVFlutterViewController alloc] init];
[GeneratedPluginRegistrant registerWithRegistry:controller];
[controller setInitialRoute:route];
使用这种方式可以成功传递route,并且不会影响插件的注册
Yes, it woks for me. You saved my 2 days time, thanks a lot.
亲们,这个法子真的可以啊,[GeneratedPluginRegistrant registerWithRegistry:controller]; 而不是[GeneratedPluginRegistrant registerWithRegistry:self.engine];
官网害死人啦。
---------来自被这个问题搞疯了两天的程序媛。。
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This is somewhat the same as #31185 and now covered under #31185. Also adding some clarifications in flutter/engine#14367. To be fair, this API is indeed unclear and confusing. I think we want to gradually discourage its use but don't have a great alternative yet. In general, we should make all custom interop easier #32930 so you can pass any initialization data you'd like at startup, not only route. Also, if we were to make built-in concepts like route easier, we should do it on top of the upcoming navigator APIs rather than adding more to the current imperative navigator APIs. #45938 |
Yes, it woks for me. |
its working, but showing splash screen before pushing to flutterViewController and when we are trying to pop from flutterViewController its pop to black screen instead of our native iOS ViewController. Also we have another issue when we create flutterView without flutterengine like getting MissingPluginException for FlutterMethodChannel. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
When I use
initWithEngine:nibName:bundle:
to createFlutterViewController
, and thensetInitialRoute:
;I find it doesn't work; When I usewindow.defaultRouteName
inmain.dart
I get'/'
This is the code:
I always get a Text and content is ''Unknown route: /'
The text was updated successfully, but these errors were encountered: