-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform team
Description
Steps to reproduce
Putting a flutter screen in an iOS share extension causes it to crash due to exceeded memory limits.
- Create a flutter app
- Set up share sheet extension (https://docs.flutter.dev/platform-integration/ios/app-extensions#creating-app-extension-uis-with-flutter)
- Open project in Xcode
- Run on a physical iOS device
- Setup debugger for share extension
5.1. In Xcode > Debug > Attach to Process by PID or Name...
5.2. Input name of extension
5.3. Click attach - Open Safari
- Click share icon, scroll to the right to "More" with three dots
- Find your app and click on it
- Flutter screen may or may not show. If it does, try scrolling
- App should crash with below message:
Expected results
App should not crash
Memory limits for running app extensions are significantly lower than the memory limits imposed on a foreground app. On both platforms, the system may aggressively terminate extensions because users want to return to their main goal in the host app.
Your app extension doesn’t own the main run loop, so it’s crucial that you follow the established rules for good behavior in main run loops.
Actual results
App crashes
Code sample
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, child) => Scaffold(
body: ListView.builder(
itemCount: 100,
itemBuilder: (context, index) => ListTile(
title: Text('Item $index'),
),
),
),
);
}
}Screenshots or Video
Logs
No response
Flutter Doctor output
Doctor output
[Paste your output here]Metadata
Metadata
Assignees
Labels
engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform team
