plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Share_plus] Ipad not working

Open kjawadDeveloper opened this issue 3 years ago • 11 comments

Share plus plugin version 4.0.4 is not working on IPAD while working on android correctly.

kjawadDeveloper avatar May 25 '22 04:05 kjawadDeveloper

I tested share_plus 4.0.4 on an iPad simulator (software version 15.5) and a physical iPad device (software version 15.3.1), after executing Share.share('some text'), there was no response. The same code worked well on an iPhone simulator.

The following error was encountered when running on a physical iPad:

[ShareSheet] connection invalidated
[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:0x28387e620 h=-&- v=--& _UIActivityContentNavigationBar:0x102707bb0.minY == 0   (active, names: '|':UILayoutContainerView:0x1027fb8d0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x28387cdc0 h=-&- v=--& _UIActivityContentNavigationBar:0x102707bb0.height == 50   (active)>",
    "<NSLayoutConstraint:0x283879310 V:[_UIActivityContentNavigationBar:0x102707bb0]-(0)-[UIFocusContainerGuide:0x282435b30'UINavigationControllerContentFocusContainerGuide']   (active)>",
    "<NSLayoutConstraint:0x283879450 UIFocusContainerGuide:0x282435b30'UINavigationControllerContentFocusContainerGuide'.bottom == UILayoutContainerView:0x1027fb8d0.bottom   (active)>",
    "<NSLayoutConstraint:0x28387ec10 V:|-(0)-[UILayoutContainerView:0x1027fb8d0]   (active, names: '|':UIView:0x157b04080 )>",
    "<NSLayoutConstraint:0x28387e940 UILayoutContainerView:0x1027fb8d0.bottom == UIView:0x157b04080.bottom   (active)>",
    "<NSLayoutConstraint:0x28387d4a0 'UIView-Encapsulated-Layout-Height' UIView:0x157b04080.height == 0   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x283879310 V:[_UIActivityContentNavigationBar:0x102707bb0]-(0)-[UIFocusContainerGuide:0x282435b30'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.
[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:0x2838769e0 H:|-(0)-[_UIActivityContentTitleView:0x1027945e0]   (active, names: '|':_UINavigationBarContentView:0x10276d7f0'check out my website http...' )>",
    "<NSLayoutConstraint:0x283876b70 _UIActivityContentTitleView:0x1027945e0.trailing == _UINavigationBarContentView:0x10276d7f0'check out my website http...'.trailing   (active)>",
    "<NSLayoutConstraint:0x283875950 LPLinkView:0x1027c5140.leading == UILayoutGuide:0x28223db20'UIViewLayoutMarginsGuide'.leading   (active)>",
    "<NSLayoutConstraint:0x283876850 H:[LPLinkView:0x1027c5140]-(27)-|   (active, names: '|':_UIActivityContentTitleView:0x1027945e0 )>",
    "<NSLayoutConstraint:0x28387c820 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x10276d7f0'check out my website http...'.width == 0   (active)>",
    "<NSLayoutConstraint:0x2838765d0 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x28223db20'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIActivityContentTitleView:0x1027945e0 )>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x283875950 LPLinkView:0x1027c5140.leading == UILayoutGuide:0x28223db20'UIViewLayoutMarginsGuide'.leading   (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.

daniellai avatar May 31 '22 00:05 daniellai

Please use the Bug template to fill a bug report and include all the information in it

miquelbeltran avatar May 31 '22 13:05 miquelbeltran

I'm getting this error too, is there a solution?

kemalyilmaz77 avatar Jun 01 '22 05:06 kemalyilmaz77

Maybe the documentation helps?

  /// The optional [sharePositionOrigin] parameter can be used to specify a global
  /// origin rect for the share sheet to popover from on iPads. It has no effect
  /// on non-iPads.

miquelbeltran avatar Jun 01 '22 06:06 miquelbeltran

I'm getting the same error. Any workaround or fix out there? This blocks all of my apps from a new release...

krille-chan avatar Jun 04 '22 18:06 krille-chan

It works for me. See screenshot.

Can you provide a code sample that fails for you?

image

miquelbeltran avatar Jun 06 '22 07:06 miquelbeltran

Had the same problem on iPad. Without providing sharePositionOrigin it will not work. Code can be taken from plugin example.

XRayAdamo avatar Jun 26 '22 01:06 XRayAdamo

Without providing sharePositionOrigin it will not work.

Of course not, you have to provide this parameter on iPads, it is explained in the documentation

miquelbeltran avatar Jun 27 '22 06:06 miquelbeltran

I'm also experiencing this error on iPad when sharing a file (it's a PDF if that's relevant?), even though I'm providing the sharePositionOrigin:

final box = context.findRenderObject() as RenderBox?;

Share.shareFiles(
  [file.path],
  mimeTypes: ['application/pdf'],
  // share_plus requires iPad users to provide the sharePositionOrigin parameter.
  // Without it, share_plus will not work on iPads and may cause a crash or letting the UI not responding.
  sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);

Result: nothing happens, and this appears in the console:

[ShareSheet] connection invalidated

jamesncl avatar Jul 29 '22 14:07 jamesncl

@jamesncl which context are you using?

Can you provide the full code sample?

The context that you use matters, because the box size and position will be different depending on the context you use. The simplest solution is to wrap the button that opens the share dialog with a Builder as seen in the README.md

However, this is a different type of error:

Result: nothing happens, and this appears in the console: [ShareSheet] connection invalidated

You should probably create a new ticket and provide all the required info

miquelbeltran avatar Jul 31 '22 12:07 miquelbeltran

Hello,

On my side, when provided sharePositionOrigin as box!.localToGlobal(Offset.zero) & box.size in landscape mode on iPad it presents Share dialog out of my view. I switched it to box!.localToGlobal(Offset(context.width, 0)) & box.size and it works fine now: Share dialog is presented in the middle of the screen. Please note that in my app share option is called from application bar.

So if you don't face any errors, you have to manipulate with Offset value to display your Share dialog.

matszafraniec avatar Aug 10 '22 11:08 matszafraniec

@miquelbeltran @daniellai @tarja77 @jamesncl Please check what's issue I am using share_plus 4.1.0 on an iPhone 7 after executing Share.share('deeplink with socialMetaTagParameters for preview ') i also added sharePositionOrigin but not working

deep link: https://firebase.google.com/docs/dynamic-links/flutter/create

It's working fine for WhatsApp when i shared but not for skype image_2022_09_13T11_21_00_470Z Logs:

[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:0x28004d3b0 _UIActivityActionCellTitleLabel:0x159c5ae50.height >= 27.5 (active)>", "<NSLayoutConstraint:0x280047570 V:|-(15)-[_UIActivityActionCellTitleLabel:0x159c5ae50] (active, names: '|':UIView:0x159c5ba50 )>", "<NSLayoutConstraint:0x2800b12c0 V:[_UIActivityActionCellTitleLabel:0x159c5ae50]-(15)-| (active, names: '|':UIView:0x159c5ba50 )>", "<NSLayoutConstraint:0x28004f7a0 'UIView-Encapsulated-Layout-Height' UIView:0x159c5ba50.height == 52 (active)>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x28004d3b0 _UIActivityActionCellTitleLabel:0x159c5ae50.height >= 27.5 (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. when i shared from iOS app: Screenshot 2022-09-13 at 5 19 45 PM

when i shared from Android app: Screenshot 2022-09-13 at 5 20 55 PM

swapnilsinha17 avatar Sep 13 '22 11:09 swapnilsinha17

It's working fine for WhatsApp when i shared but not for skype

If it is working fine on some apps but not on one specific app, to me, it looks like a specific problem of that app and not on the plugin side

miquelbeltran avatar Sep 14 '22 06:09 miquelbeltran

@miquelbeltran how this issue from app side ..it's looks like something in internal file..Please check below logs

Logs:

[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:0x28004d3b0 _UIActivityActionCellTitleLabel:0x159c5ae50.height >= 27.5 (active)>", "<NSLayoutConstraint:0x280047570 V:|-(15)-[_UIActivityActionCellTitleLabel:0x159c5ae50] (active, names: '|':UIView:0x159c5ba50 )>", "<NSLayoutConstraint:0x2800b12c0 V:[_UIActivityActionCellTitleLabel:0x159c5ae50]-(15)-| (active, names: '|':UIView:0x159c5ba50 )>", "<NSLayoutConstraint:0x28004f7a0 'UIView-Encapsulated-Layout-Height' UIView:0x159c5ba50.height == 52 (active)>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x28004d3b0 _UIActivityActionCellTitleLabel:0x159c5ae50.height >= 27.5 (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.

swapnilsinha17 avatar Sep 14 '22 07:09 swapnilsinha17

Unable to simultaneously satisfy constraints.

This has been documented in the README.md, when using the share_plus on iPad the sharePositionOrigin must be provided, and this needs to be correct. If you are not provided sample code showing how you exactly calculate this value we cannot help you.

miquelbeltran avatar Sep 14 '22 07:09 miquelbeltran

@miquelbeltran i tested with this as well sharePositionOrigin but not fixed ..Let me share sample code with you

swapnilsinha17 avatar Sep 14 '22 08:09 swapnilsinha17

Hii @miquelbeltran Please look into this ..it's urgent i am using share_plus: ^4.1.0

Flutter (Channel stable, 2.10.5, on macOS 11.6.5 20G527 darwin-x64, locale en-GB)
    • Flutter version 2.10.5 at /Users/elintminds/Documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (5 months ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/elintminds/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2021.1)
    • 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.11+0-b60-7590822)

[✓] Connected device (3 available)
    • Elint’s iPhone (mobile)    • caeedac25a54fc67101807449f92effc8f753851 • ios            • iOS 14.7.1 18G82
    • iPhone 13 Pro Max (mobile) • 5C849666-2ACD-4315-8822-D1C3E96DA04A     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)               • chrome                                   • web-javascript • Google Chrome 105.0.5195.125

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

• No issues found!

sample code:

void _shareNews(BuildContext context)  {
    String _shareMessage =
    '''check out: Naira appreciates 0.10% against dollar at official market. Visit https://www.ripplesnigeria.com/naira-appreciates-0-10-against-dollar-at-official-market/  to get more details.''';
    try {
      final box = context.findRenderObject() as RenderBox?;
      Share.share(_shareMessage,  sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
      );
    } catch (e) {
      debugPrint('${e.toString()}');
    }
  }

Check this above code Share it on whatsApp and Skype .You can see what issue would get when you share it on Skype. Log :


[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:0x283ca7a20 _UIActivityActionCellTitleLabel:0x15c10b6b0.height >= 27.5   (active)>",
    "<NSLayoutConstraint:0x283ca5c70 V:|-(15)-[_UIActivityActionCellTitleLabel:0x15c10b6b0]   (active, names: '|':UIView:0x15c11e260 )>",
    "<NSLayoutConstraint:0x283ca7bb0 V:[_UIActivityActionCellTitleLabel:0x15c10b6b0]-(15)-|   (active, names: '|':UIView:0x15c11e260 )>",
    "<NSLayoutConstraint:0x283ca79d0 'UIView-Encapsulated-Layout-Height' UIView:0x15c11e260.height == 52   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x283ca7a20 _UIActivityActionCellTitleLabel:0x15c10b6b0.height >= 27.5   (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.


swapnilsinha17 avatar Sep 14 '22 08:09 swapnilsinha17

void _shareNews(BuildContext context)  {

Where are you getting this context from?

miquelbeltran avatar Sep 14 '22 08:09 miquelbeltran

@miquelbeltran from Widget build(BuildContext context) {

swapnilsinha17 avatar Sep 14 '22 09:09 swapnilsinha17

So that's probably wrong, and you are not providing a valid Rect in the sharePositionOrigin.

If you look at the example main.dart you will see that the share call is wrapped with a Builder, and it is not using the context from the top widget.

You need to understand what your code does, rather than copying code and complaining that things don't work.

miquelbeltran avatar Sep 14 '22 09:09 miquelbeltran

I am closing this issue now, if you have a problem providing the sharePositionOrigin, run the example in the project and see if you can reproduce the issue. If the example works, but your code doesn't, then there's a bug in your code.

miquelbeltran avatar Sep 14 '22 09:09 miquelbeltran