Skip to content

[Share_plus] Ipad not working #870

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

Closed
kjawadDeveloper opened this issue May 25, 2022 · 21 comments
Closed

[Share_plus] Ipad not working #870

kjawadDeveloper opened this issue May 25, 2022 · 21 comments
Labels
bug Something isn't working iPadOs missing info Not enough info or not following the issue template share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin

Comments

@kjawadDeveloper
Copy link

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

@kjawadDeveloper kjawadDeveloper added the bug Something isn't working label May 25, 2022
@daniellai
Copy link

daniellai commented May 31, 2022

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.

@miquelbeltran miquelbeltran added share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin iPadOs missing info Not enough info or not following the issue template labels May 31, 2022
@miquelbeltran
Copy link
Member

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

@kemalyilmaz77
Copy link

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

@miquelbeltran
Copy link
Member

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.

@krille-chan
Copy link

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

@miquelbeltran
Copy link
Member

It works for me. See screenshot.

Can you provide a code sample that fails for you?

image

@XRayAdamo
Copy link

XRayAdamo commented Jun 26, 2022

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

@miquelbeltran
Copy link
Member

Without providing sharePositionOrigin it will not work.

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

@jamesncl
Copy link

jamesncl commented Jul 29, 2022

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

@miquelbeltran
Copy link
Member

miquelbeltran commented Jul 31, 2022

@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

@matszafraniec
Copy link

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.

@swapnilsinha17
Copy link

swapnilsinha17 commented Sep 13, 2022

@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

@miquelbeltran
Copy link
Member

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

@swapnilsinha17
Copy link

swapnilsinha17 commented Sep 14, 2022

@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.

@miquelbeltran
Copy link
Member

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.

@swapnilsinha17
Copy link

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

@swapnilsinha17
Copy link

swapnilsinha17 commented Sep 14, 2022

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.


@miquelbeltran
Copy link
Member

void _shareNews(BuildContext context)  {

Where are you getting this context from?

@swapnilsinha17
Copy link

@miquelbeltran from Widget build(BuildContext context) {

@miquelbeltran
Copy link
Member

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
Copy link
Member

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.

@fluttercommunity fluttercommunity locked as off-topic and limited conversation to collaborators Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working iPadOs missing info Not enough info or not following the issue template share_plus Feature, Enhancement, Bug Fixes for Share Plus Plugin
Projects
None yet
Development

No branches or pull requests

9 participants