[add-to-app] Cannot re-open Flutter screen after multiple transitions between iOS native and Flutter

Đang mở
#2,654 3 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
dart, flutter, ios
Lĩnh vực
mobile-dev

Hướng nghiên cứu

Bắt đầu với ứng dụng add_to_app/fullscreen và tái hiện các lần chuyển đổi lặp lại bằng các phiên bản Flutter, Xcode và iOS được liệt kê. So sánh vòng đời của ứng dụng này với các ứng dụng add_to_app/plugin và add_to_app/multiple_flutters, tập trung vào lỗi đính kèm FlutterViewController được ghi lại. Hoàn tất khi màn hình Flutter có thể được mở và đóng lặp lại mà không xảy ra lỗi hoặc không hiển thị.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Steps to Reproduce

  1. Launch the fullscreen app.
  2. Tap "Launch Flutter ViewController" to open the Flutter screen.
  3. Tap "Exit this screen" to close the Flutter screen.
  4. Repeat steps 2 and 3.
  5. 💥Tap "Launch Flutter ViewController", but the Flutter screen does not appear.

https://github.com/user-attachments/assets/9f3a406f-4380-4fb7-a633-222a19243fb6

Environment

Flutter: 3.32.4
Xcode: 16.4
iOS Simulator: iPhone 16 (iOS 18.5)

Additional Information

  • The following message is logged when attempting to transition to the Flutter screen, even if the transition appears successful.
    [ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm(183)] The supplied FlutterEngine <FlutterEngine: 0x104807470> is already used with FlutterViewController instance <FlutterViewController: 0x10e808600>. One instance of the FlutterEngine can only be attached to one FlutterViewController at a time. Set FlutterEngine.viewController to nil before attaching it to another FlutterViewController.
    
  • Also appeared in the plugin app and an app built following the official guide.
  • The number of transitions before the issue appears varies.
  • Not appeared in the multiple_flutters app.
  • I think setting flutterEngine.viewController = nil on Flutter screen dismissal would solve the problem, but I don't know if this is the right or recommended solution.
Ngôn ngữ chính
Dart
Star
19.3k
Fork
7.8k
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của flutter/samples

Tất cả issue của flutter/samples

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.