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

Crash when share from some apps. [iOS] #113

Open
Shchepotin opened this issue Mar 29, 2021 · 16 comments
Open

Crash when share from some apps. [iOS] #113

Shchepotin opened this issue Mar 29, 2021 · 16 comments

Comments

@Shchepotin
Copy link

ShareExtension works fine is most cases, but when I try share url from some apps, for example Mango, ShareExtension crash.

I debug ShareExtension and get error in https://github.com/meedan/react-native-share-menu/blob/master/ios/ShareViewController.swift#L163.

I think it's happen because Mango app share few attachments (image, url) and ShareViewController return only first attachment (image). Can we return all (I think this is the right way) or first attachment which supported by app type identifiers? My app work only with URL and plain text and don't handle image.

@mdmush
Copy link

mdmush commented Apr 7, 2021

I'm facing this issue as well. Does anybody have solution for this?

@yannikw23
Copy link

yannikw23 commented Apr 19, 2021

Same here...Has anyone found a solution? Happens for Twitter, LinkedIn, Reddit (and others) for me. Safari works fine.

At first I suspected that the max memory limit of an extension has been reached causing the extension to close automatically. Not too sure about that one though, also hard to debug...

In debug mode on a real device it always closes automatically (from any app, also from safari). In release mode it does not provide any information via Xcode.

@yannikw23
Copy link

Ok, I inspected the issue using the MacOS Console tool to get detailed device logs. This is the fatal error crashing the extension:

default 13:12:49.844917+0200 kernel EXC_RESOURCE -> <EXTENSION_NAME>[13182] exceeded mem limit: InactiveHard 120 MB (fatal)

This is a pain, as I don't know how to reduce the required memory...I use AWS Amplify and a couple of other frameworks which seem to be very memory intensive. And unfortunately I need them for my application.

@Gustash do you have any idea how to tackle this? Maybe reducing image size (I display a couple in my extension's custom view) would also help?
Any help is highly appreciated!

@Sharisu
Copy link

Sharisu commented May 21, 2021

Same problem.

I tried debbug with the XCode Profiler and found that the extension on the simulator consumes 3 times more memory than the main application. But there are much fewer components in it. On a real device, the situation is almost the same.

In my case it always falls (9 times out of 10) when I try share inside Soundcloud. Always memory issue on load

@yannikw23
Copy link

yannikw23 commented May 31, 2021

@Sharisu I've been struggling with this for a while now and currently I am using a very hacky work around:

I created a MemoryWarningHandler component which is imported in my share extension. On memory warning it calls ShareMenu.continueInApp() to handle the sharing in there. That way at least the user has the chance to complete the sharing transaction.

const MemoryWarningHandler = (props: MemoryWarningProps) => {
  const { onMemoryWarningCallback } = props;

  useEffect(() => {
    // Listen for AppState memoryWarning event
    AppState.addEventListener('memoryWarning', (state) => {
      console.warn('Triggered memoryWarning. Initiating continueInApp');
      // call callback on warningEvent triggered
      onMemoryWarningCallback();
    });

    return () => {
      AppState.removeEventListener('memoryWarning', () => {});
    };
  }, []);

  return null;
};

This is very far from ideal, but it gets the job done (at the expense of user experience)...
Maybe it helps you as well.

@Gustash Are there any updates on this?
@caiosba maybe?

@alexpluto
Copy link

This is still an issue for us as well.

Strangely this is predominately affecting when sharing from Instagram app.

@Gustash have you been able to look into this at all? Thank you!

@yannikw23
Copy link

@alexpluto Do you currently have a workaround for this issue?

@alexpluto
Copy link

@yannikw23 this workaround didn't work for us and we still have no other solutions... :(

@Sharisu
Copy link

Sharisu commented Jun 15, 2021

@yannikw23 nice trick! This made the situation better, but did not completely solve the problem. Thanks for idea :)

@Kumskov-dev
Copy link

@yannikw23 I have the same issue when I'm trying to share some data from Instagram app .
ShareExtension is crashed immediately in most cases, adding "memoryWarning" listener doesn't solve my problem, the crash is still exist.

@yannikw23
Copy link

@Sharisu - yeah, same here. It made the situation bearable, but definitely still far from ideal.

@Kumskov-dev I see. Yes, the crash still appears but we catch that in the main app then since we call continueInApp().

It's a bit frustrating...Is any of you sufficiently advanced in native dev to investigate this further?

Otherwise, can we hope for support? @Gustash (sorry to keep bringing it up, it's just a major hurdle)

@alexpluto
Copy link

Or maybe @caiosba (seems like another big contributor here). Any help would be super helpful guys! Thank you in advance.

@caiosba
Copy link
Collaborator

caiosba commented Jun 17, 2021

I just maintain the Android version... @Gustash do you have any chance to look into it?

We accept PRs from the community too, if anyone is able to fix it.

@alexpluto
Copy link

@Gustash I was just wondering if you ever managed to look at this issue? It's still affecting us now unfortunately :(

@eranga-akva
Copy link

Got the same issue, for example in ios gmail app, opening a url inside the gmail app (not in the browser), and trying to share the url using share menu crashes the share modal. I see the following in xcode.
Screenshot 2021-12-15 at 12 10 07

@RDR96
Copy link

RDR96 commented Jul 14, 2023

I think all this is related to how the default share popup is displayed to the user.
See this #256

I was having the same issues with some apps, I realized is related with how the preview content is displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants