8000 Share button in textfield menu crashes app on iPad · Issue #138550 · flutter/flutter · GitHub
[go: up one dir, main page]

Skip to content
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

Share button in textfield menu crashes app on iPad #138550

Closed
2 tasks done
ueman opened this issue Nov 16, 2023 · 2 comments · Fixed by flutter/engine#48220
Closed
2 tasks done

Share button in textfield menu crashes app on iPad #138550

ueman opened this issue Nov 16, 2023 · 2 comments · Fixed by flutter/engine#48220
Assignees
Labels
a: tablet Tablets and landscape phones a: text input Entering text in a text field or keyboard related problems c: fatal crash Crashes that terminate the process engine flutter/engine repository. See also e: labels. found in release: 3.16 Found to occur in 3.16 found in release: 3.17 Found to occur in 3.17 has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team

Comments

@ueman
Copy link
Contributor
ueman commented Nov 16, 2023

Is there an existing issue for this?

Steps to reproduce

Use the following code example below

  1. Run it on an iPad
  2. Type something into the text field
  3. Double tap on the entered code and use the share button

Basically do what the gif shows in the Add additional options in edit menu section of the release article here https://medium.com/flutter/whats-new-in-flutter-3-16-dba6cb1015d1 but on an iPad.

This can be reproduced on an iPad Simulator, too.

I suspect what's missing is what's described here. On an iPad, the share dialog needs to know where it should be shown. If nothing is passed for the position, it just crashes.

Looking at the source, it seems plausible.
The framework part doesn't pass source coordinates to the engine side:

await SystemChannels.platform.invokeMethod(
'Share.invoke',
text,
);

Taking a further look at the engine and there's also no source rectangle passed to the share dialog:

https://github.com/flutter/engine/blob/b37d8573df6ffa9106dc31788ec648f6e8607c58/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm#L155-L162

The relevant PRs that introduced this are #132599 and flutter/engine#44554. Based on those, I think @LouiseHsu could help here.

Expected results

I'm able to share the text

Actual results

App crashes

Code sample

Code sample
import 'package:flutter/material.dart';

const Color darkBlue = Color.fromARGB(255, 18, 32, 47);

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        scaffoldBackgroundColor: darkBlue,
      ),
      home: Scaffold(
        body: Center(
          child: TextField(),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.0, on macOS 14.0 23A344 darwin-arm64, locale en-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.84.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Nov 17, 2023
@danagbemava-nc
Copy link
Member

Reproducible using the code sample and steps shared above.

*** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<UIPopoverPresentationController: 0x110e11960>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
*** First throw call stack:
(0x1a9c60870 0x1a1fcbc00 0x1ac462f28 0x1abf6e5d8 0x1abf6d508 0x1abe42fe0 0x1abe42dc4 0x1abe42cdc 0x1abe42a68 0x1abe42964 0x1abe42468 0x1abe41b58 0x1abe41c14 0x1a9bab31c 0x1a9baa598 0x1a9ba8dac 0x1a9ba7a88 0x1a9ba7668 0x1ecf725ec 0x1abfc4294 0x1abfc38d0 0x100fc8514 0x1cc5fadcc)
libc++abi: terminating due to uncaught exception of type NSException
Type: stdio
flutter doctor -v
[!] Flutter (Channel stable, 3.16.0, on macOS 14.0 23A344 darwin-arm64, locale en-GB)
    • Flutter version 3.16.0 on channel stable at /Users/nexus/dev/sdks/flutter
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (2 days ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc1)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0-rc1
    • Java binary at: /Users/nexus/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode-15.0.0-Release.Candidate.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nexus/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.5)
    • IntelliJ at /Users/nexus/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 76.3.4
    • Dart plugin version 232.10072.19

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (4 available)
    • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 17.1.1 21B91
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 17.1 21B74
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 119.0.6045.159

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
[✓] Flutter (Channel master, 3.17.0-10.0.pre.42, on macOS 14.0 23A344 darwin-arm64, locale en-GB)
    • Flutter version 3.17.0-10.0.pre.42 on channel master at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e9de448420 (7 hours ago), 2023-11-17 02:08:13 +0100
    • Engine revision 5064aeff00
    • Dart version 3.3.0 (build 3.3.0-143.0.dev)
    • DevTools version 2.30.0-dev.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc1)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0-rc1
    • Java binary at: /Users/nexus/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode-15.0.0-Release.Candidate.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nexus/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.5)
    • IntelliJ at /Users/nexus/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 76.3.4
    • Dart plugin version 232.10072.19

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (4 available)
    • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 17.1.1 21B91
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 17.1 21B74
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 14.0 23A344 darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 119.0.6045.159

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@danagbemava-nc danagbemava-nc added platform-ios iOS applications specifically engine flutter/engine repository. See also e: labels. a: tablet Tablets and landscape phones has reproducible steps The issue has been confirmed reproducible and is ready to work on c: fatal crash Crashes that terminate the process team-ios Owned by iOS platform team found in release: 3.16 Found to occur in 3.16 found in release: 3.17 Found to occur in 3.17 a: text input Entering text in a text field or keyboard related problems and removed in triage Presently being triaged by the triage team labels Nov 17, 2023
@leighajarett leighajarett added the P1 High-priority issues at the top of the work list label Nov 17, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue Nov 22, 2023
@danagbemava-nc danagbemava-nc added the r: fixed Issue is closed as already fixed in a newer version label Nov 23, 2023
LouiseHsu added a commit to LouiseHsu/engine that referenced this issue Nov 27, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue Nov 30, 2023
Copy link
github-actions bot commented Dec 7, 2023

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2023
DenisovAV pushed a commit to DenisovAV/flutter-tvos-engine that referenced this issue May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: tablet Tablets and landscape phones a: text input Entering text in a text field or keyboard related problems c: fatal crash Crashes that terminate the process engine flutter/engine repository. See also e: labels. found in release: 3.16 Found to occur in 3.16 found in release: 3.17 Found to occur in 3.17 has reproducible steps The issue has been confirmed reproducible and is ready to work on P1 High-priority issues at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
0