Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Bug] Share Text does not work on iPadOS 13.2 & 13.2.2

Open bobwhitten opened this issue 7 years ago • 21 comments

Description

Share Text for iPadOS 13.2 and 13.2.2 does not bring up "pop-over" window, so does not function.

It appears to work fine on iPhone and and versions iPadOS 13.1 and previous.

Asked on Xamarin Forum.

Steps to Reproduce

  1. Attached is sample program -- empty Blank XF program with single button added to share text.
  2. Click on button, nothing happens on iPadOS 13.2, but works on iPhone, older iPads.

Expected Behavior

Pop-Over (activity controller) allows shared text to be sent to various apps

Actual Behavior

Nothing happens

Basic Information

  • Version with issue: 1.3.1, XF 4.2.910310
  • Last known good version: unknown
  • IDE: VS for PC 16.3.7
  • Platform Target Frameworks:
    • iPadOS: 13.2 and 13.2.2
  • Affected Devices: iPad Air

Reproduction Link

ShareTest.zip

bobwhitten avatar Nov 11 '19 23:11 bobwhitten

Share File also does not work

iWeaverMan avatar Nov 12 '19 06:11 iWeaverMan

As a workaround/hack until the PR is approved you can call the Share.RequestAsync twice. For some reason, it works this way, to some extent.

await Share.RequestAsync(new ShareTextRequest
{
    Text = "Share me!"
});

if (Device.Idiom == TargetIdiom.Tablet)
{
    //todo: change after PR #979 for Xamarin.Essensialas is intergrated (https://github.com/xamarin/Essentials/issues/979)
    await Share.RequestAsync(new ShareTextRequest
    {
        Text = "Share me!"
    });
}

anndreiAbabei avatar Nov 12 '19 22:11 anndreiAbabei

I've done a little more investigation of this. On my iPad with 12.4.2, the "SourceRect" in the native code is "X=0,Y=0,Width=0,Height=0". On my iPad with 13.2, it is "X=Infinity,Y=Infinity,Width=0,Height=0".

And, now that I think about it, the system "feels" like there is a non-visible pop-up up.

I think if nothing else changes, I will change my PR to check for infinities and replace with 0, unless there is a better idea. (For example, Issue #944 suggests that the pop-up should be top-right).

There appears no way currently for XE Share to position the pop-up, which for the most part is probably OK with most.

bobwhitten avatar Nov 12 '19 23:11 bobwhitten

As a workaround/hack until the PR is approved you can call the Share.RequestAsync twice. For some reason, it works this way, to some extent.

await Share.RequestAsync(new ShareTextRequest
{
    Text = "Share me!"
});

if (Device.Idiom == TargetIdiom.Tablet)
{
    //todo: change after PR #979 for Xamarin.Essensialas is intergrated (https://github.com/xamarin/Essentials/issues/979)
    await Share.RequestAsync(new ShareTextRequest
    {
        Text = "Share me!"
    });
}

I've done a little test for myself -- I didn't like the results. On iPad with iOS12, I got two pop-ups. On iPad 13.2.2, I did not get any.

bobwhitten avatar Nov 13 '19 20:11 bobwhitten

@Redth Please approve that PR by bobwhitten as soon as possible and release a new version or preview version on nuget, since this is a mission critical bug and the workaround posted here doesn't work.

daniels7 avatar Nov 15 '19 11:11 daniels7

I got some comments here that may be useful to discuss: https://github.com/xamarin/Essentials/pull/980#issuecomment-554398486

mattleibow avatar Nov 15 '19 15:11 mattleibow

I don't want to push anyne and I'm very thankful for everyone who contributes on fixing this issue. But no matter how, please do it as soon as possible, it breaks a lot of apps on new iOS devices and developers can't tell the customers not to update their devices to a new stable iPadOS Version

daniels7 avatar Nov 18 '19 09:11 daniels7

Thanks everyone for working on this. We hope to have an update soon!

traceyhemp12 avatar Nov 20 '19 12:11 traceyhemp12

@mattleibow @Redth @jamesmontemagno Is there any chance of getting an updated Nuget Package within this week? Due to our release cycle we otherwise have to wait more than 7 weeks to get a new version of our App without that Bug out. I'm very thankful for everyone working on getting that fixed.

daniels7 avatar Nov 20 '19 13:11 daniels7

Sorry, but no that isn’t going to happen this week. You’re best off with forking and building it yourself in this case 😔

Redth avatar Nov 20 '19 13:11 Redth

How can the integration of 10 Lines of code on a mission critical bug take longer than 2 weeks? :( @bobwhitten commited a fix on 12th of November...

daniels7 avatar Nov 20 '19 13:11 daniels7

This bit of code fixed the issue in our project, on iOS 13.2. Hope it helps.

///hot fix var window = UIApplication.SharedApplication.KeyWindow; var vc = window.RootViewController; while (vc.PresentedViewController != null) { vc = vc.PresentedViewController; }

        if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
        {
            var sr = new CoreGraphics.CGRect(vc.View.Bounds.Width, 20, 0, 0);
            ctrl.PopoverPresentationController.SourceRect = sr;
        }
        //END OF HOTFIX

traceyhemp12 avatar Nov 21 '19 19:11 traceyhemp12

Please see #980 for more info on how we are going to address this.

I realize this is a seemingly small change and is critical for some. We are going to roll the fix into our next release.

Redth avatar Nov 23 '19 14:11 Redth

Duplicate of #944 and will be addressed by #1002

Redth avatar Nov 25 '19 21:11 Redth

@Redth This issue is back.

g4mb10r avatar Apr 23 '20 19:04 g4mb10r

Please open a new issue with more details.

Redth avatar Apr 23 '20 19:04 Redth

The bug has returned with iPad 13.4.x

LooWooL avatar Apr 25 '20 12:04 LooWooL

I'm seeing it too. Works on old iPad with 12.4.6. Another breaking change from Apple?

bobwhitten avatar Apr 25 '20 14:04 bobwhitten

@Redth This is the same bug. This is what the console says when you try to share on iPad:

[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:0x60000146d860 LPLinkView:0x7fcf1b79e2b0.leading == UILayoutGuide:0x600000ec6060'UIViewLayoutMarginsGuide'.leading (active)>", "<NSLayoutConstraint:0x60000146d630 H:[LPLinkView:0x7fcf1b79e2b0]-(59)-| (active, names: '|':_UIActivityContentTitleView:0x7fcf1b79dd10 )>", "<NSLayoutConstraint:0x6000014007d0 H:|-(0)-[_UIActivityContentTitleView:0x7fcf1b79dd10] (active, names: '|':_UINavigationBarContentView:0x7fcf1b7aa450 )>", "<NSLayoutConstraint:0x600001400500 _UIActivityContentTitleView:0x7fcf1b79dd10.trailing == _UINavigationBarContentView:0x7fcf1b7aa450.trailing (active)>" , "<NSLayoutConstraint:0x600001404aa0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7fcf1b7aa450.width == 0 (active)>", "<NSLayoutConstraint:0x60000146d720 'UIView-leftMargin-guide-constraint' H:|-(16)-UILayoutGuide:0x600000ec6060'UIViewLayoutMarginsGuide' (active, names: '|':_UIActivityContentTitleView:0x7fcf1b79dd10 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x60000146d860 LPLinkView:0x7fcf1b79e2b0.leading == UILayoutGuide:0x600000ec6060'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.

g4mb10r avatar Apr 27 '20 18:04 g4mb10r

I can't reproduce this on the simulator with just a simple Share. please open a new bug with repro code.

jamesmontemagno avatar Apr 27 '20 19:04 jamesmontemagno