fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.62k stars 976 forks source link

[Bug]: iPad不能调起分享 #1484

Closed LIYONGBIN123456 closed 1 year ago

LIYONGBIN123456 commented 1 year ago

Platform

iPad 9代 15.4系统

Plugin

share_plus

Version

6.3.0

Flutter SDK

2.18.4

Steps to reproduce

iPhone能分享,iPad不行

Code Sample

final shareResult = await Share.shareXFiles(
      [
        XFile.fromData(
          widget.bytes,
          path: widget.fileLocalPath,
          mimeType: widget.mimeType ?? "",
        ),
      ],
      // text: "万兴去水印提示",
      subject: "${widget.fileName}",
      sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
    );

Logs

Default] Task Runner[1841]/1#3 LF=0 couldn't find entitlement CopresenceCore.Entitlement.publicAPI error nil
[LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want.
    Try this:
        (1) look at each constraint and try to figure out which you don't expect;
        (2) find the code that added the unwanted constraint or constraints and fix it.
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
    "<NSAutoresizingMaskLayoutConstraint:0x283c8b5c0 h=-&- v=--& _UIActivityContentNavigationBar:0x100fff310.minY == 0   (active, names: '|':UILayoutContainerView:0x100fbb840 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x283c8b610 h=-&- v=--& _UIActivityContentNavigationBar:0x100fff310.height == 50   (active)>",
    "<NSLayoutConstraint:0x283c88500 V:[_UIActivityContentNavigationBar:0x100fff310]-(0)-[UIFocusContainerGuide:0x2820fde00'UINavigationControllerContentFocusContainerGuide']   (active)>",
    "<NSLayoutConstraint:0x283c88410 UIFocusContainerGuide:0x2820fde00'UINavigationControllerContentFocusContainerGuide'.bottom == UILayoutContainerView:0x100fbb840.bottom   (active)>",
    "<NSLayoutConstraint:0x283c8aee0 V:|-(0)-[UILayoutContainerView:0x100fbb840]   (active, names: '|':UIView:0x100f655b0 )>",
    "<NSLayoutConstraint:0x283c8af80 UILayoutContainerView:0x100fbb840.bottom == UIView:0x100f655b0.bottom   (active)>",
    "<NSLayoutConstraint:0x283c8bd40 'UIView-Encapsulated-Layout-Height' UIView:0x100f655b0.height == 0   (active)>"

)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x283c88500 V:[_UIActivityContentNavigationBar:0x100fff310]-(0)-[UIFocusContainerGuide:0x2820fde00'UINavigationControllerContentFocusContainerGuide']   (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
[Default] Task Runner[1841]/1#3 LF=0 couldn't find entitlement CopresenceCore.Entitlement.publicAPI error nil
[LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want.
    Try this:
        (1) look at each constraint and try to figure out which you don't expect;
        (2) find the code that added the unwanted constraint or constraints and fix it.
(
    "<NSLayoutConstraint:0x283c85450 H:|-(0)-[_UIActivityContentTitleView:0x100eeb5f0]   (active, names: '|':_UINavigationBarContentView:0x100fff560'trim.53E17EC9-5C64-4409-9...' )>",

Flutter Doctor

@SZ21112369M01 ~ % flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0 22A380 darwin-x64, locale
    zh-Hans-CN)
    • Flutter version 3.3.8 on channel stable at
      /Users/ws/Library/Android/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (3 months ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/ws/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.3)
    • Android Studio at /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
      11.0.13+0-b1751.21-8125866)

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

[✓] Connected device (4 available)
    • hr的iPad (mobile)       • 00008030-001179CE3E78C02E            • ios
      • iOS 15.4 19E241
    • iPhone 14 Pro (mobile) • 06D04662-EB42-41FE-81EF-368AC11B68A1 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator)
    • macOS (desktop)        • macos                                • darwin-x64
      • macOS 13.0 22A380 darwin-x64
    • Chrome (web)           • chrome                               •
      web-javascript • Google Chrome 109.0.5414.119
    ! Error: hr的iPad is busy: Fetching debug symbols for hr的iPad. Xcode will
      continue when hr的iPad is finished. (code -10)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Checklist before submitting a bug

jingluoguo commented 1 year ago

你可以看一下这个回答https://github.com/fluttercommunity/plus_plugins/issues/870#issuecomment-1200419755

pirder commented 1 year ago

@LIYONGBIN123456 我也遇到这个问题,现在Clone下来自己内部维护,已经修复。

请在+ (void)share:(NSArray *)shareItems withSubject:(NSString *)subject withController:(UIViewController *)controller atSource:(CGRect)origin toResult:(FlutterResult)result withResult:(BOOL)withResult; 方法中最后PresentViewController 方法加多一个iPad 套入一个UINavigationController if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { UINavigationController *navActivityVC = [[UINavigationController alloc]initWithRootViewController:activityViewController]; navActivityVC.navigationBarHidden = YES; activityViewController.modalPresentationStyle = UIModalPresentationPopover; [controller presentViewController:navActivityVC animated:YES completion:nil]; } else { [controller presentViewController:activityViewController animated:YES completion:nil]; }

在文件的第369行 English: I also encountered this issue. Now I have cloned it and maintain it internally, and have already fixed the issue. Please add an UINavigationController for iPad by wrapping the presentViewController method in the + (void)share:(NSArray *)shareItems withSubject:(NSString *)subject withController:(UIViewController *)controller atSource:(CGRect)origin toResult:(FlutterResult)result withResult:(BOOL)withResult; method. The updated code should look like this:

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { UINavigationController *navActivityVC = [[UINavigationController alloc]initWithRootViewController:activityViewController]; navActivityVC.navigationBarHidden = YES; activityViewController.modalPresentationStyle = UIModalPresentationPopover; [controller presentViewController:navActivityVC animated:YES completion:nil]; } else { [controller presentViewController:activityViewController animated:YES completion:nil]; } On line 369 of the file... FLTSharePlusPlugin.txt

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days