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

[iOS 13] Sharing attachments from the Apple mail app no longer works #91

Open
cinnamon-doge opened this issue Jan 31, 2020 · 11 comments
Open

Comments

@cinnamon-doge
Copy link

Affected iOS Versions: 13.0 and newer

Summary: when attempting to share attachments from the Apple mail app to my Ionic v1 app in iOS 13.0 or newer, I receive the following console printout: "[OpenWithPlugin.m][checkForFileToShare] Sharing text "" and a 0 bytes image". It appears that the file data is no longer passed to my app. On iOS 12 this is working perfectly, and the "bytes" printout has a value.

Making things more interesting, the sharing functionality in gallery and files, as well as Google Drive, Gmail and Outlook, is working on iOS 13 just fine. The issue seems to be isolated to the default mail app. I've tested this on an iPhone 6 (iOS 12.3.1) and an iPhone X (iOS 13.3.1).

Steps to reproduce:

  1. Install your app with cordova-plugin-openwith configured on a device with iOS 13.0 or newer
  2. Open the default Apple mail app and locate an email with an attachment
  3. Open the attachment in the quick preview by tapping it and attempt to share it to your app
  4. Console should log "[OpenWithPlugin.m][checkForFileToShare] Sharing text "" and a 0 bytes image", at least with the plugin verbosity set to debug
@bendspoons
Copy link

bendspoons commented Feb 4, 2020

I observed the same behaviour, except my ShaeExtension crashes when sharing from Mail App, when Sharing from "Files", the PDF is shared to my App, but i have to manually put my App in Foreground to "make it happen". Pre iOS 13 my App was automatically pulled to front.

My "Customizations" were remove "LoggedIn" Featre, and change this

`- (void) viewDidAppear:(BOOL)animated {
[self.view endEditing:YES];
}

- (void) viewDidLoad {
[self setup];
[self debug:@"[viewDidLoad]"];`

to this

- (void) viewDidAppear:(BOOL)animated { [self.view endEditing:YES]; [self setup]; [self debug:@"[viewDidLoad]"];

@bendspoons
Copy link

Hi, havent seen your fix from Dec '19. Implemented it, and works with Sharing from Files (iCloud) and Photos. But when trying to share from Mail - my Shareextension crashes, right at

NSDictionary *dict = @{ (according to Device Logs Crash report)

When sharing from e.g. outlook everything works fine. Im testing on iOS 13.3.1.

Anyone experienced this too?

@bendspoons
Copy link

Affected iOS Versions: 13.0 and newer

Summary: when attempting to share attachments from the Apple mail app to my Ionic v1 app in iOS 13.0 or newer, I receive the following console printout: "[OpenWithPlugin.m][checkForFileToShare] Sharing text "" and a 0 bytes image". It appears that the file data is no longer passed to my app. On iOS 12 this is working perfectly, and the "bytes" printout has a value.

Making things more interesting, the sharing functionality in gallery and files, as well as Google Drive, Gmail and Outlook, is working on iOS 13 just fine. The issue seems to be isolated to the default mail app. I've tested this on an iPhone 6 (iOS 12.3.1) and an iPhone X (iOS 13.3.1).

Steps to reproduce:

1. Install your app with cordova-plugin-openwith configured on a device with iOS 13.0 or newer

2. Open the default Apple mail app and locate an email with an attachment

3. Open the attachment in the quick preview by tapping it and attempt to share it to your app

4. Console should log "[OpenWithPlugin.m][checkForFileToShare] Sharing text "" and a 0 bytes image", at least with the plugin verbosity set to debug

CHeck the Updated version, uninstall and reinstall this plugin should work for you!

@bendspoons
Copy link

Ok, just 2 full days of try/error, crying and weeping - i think i managed to solve most of those problems. Now i can (with ios 13):

  • Share from "Files"
  • Share from "Outlook Mail"
  • Share without crash from Mail

Im currentyl testing the whole thing through, ill make a new post when its done!

@cinnamon-doge
Copy link
Author

Ok, just 2 full days of try/error, crying and weeping - i think i managed to solve most of those problems. Now i can (with ios 13):

* Share from "Files"

* Share from "Outlook Mail"

* Share without crash from Mail

Im currentyl testing the whole thing through, ill make a new post when its done!

I'm currently testing your fork of the plugin, and sharing from the Apple mail app doesn't seem to work - it fails without error on iOS 13.3.1 with my app. Sharing from Gmail results in "Nothing to share" being logged.

@bendspoons
Copy link

bendspoons commented Feb 13, 2020

Im shocked. I changed the lines to work with iOS 13 Mail etc. directly in Xcode - it worked. So i transferred the data to the repo. Done. Today i created a new app with it - and you're right, it does not work at all. I currently have no idea what went wrong, especially because the app where i directly changed the code still works ???

Im looking into it...

@cinnamon-doge
Copy link
Author

Im shocked. I changed the lines to work with iOS 13 Mail etc. directly in Xcode - it worked. So i transferred the data to the repo. Done. Today i created a new app with it - and you're right, it does not work at all. I currently have no idea what went wrong, especially because the app where i directly changed the code still works ???

Im looking into it...

Any progress to report?

@sou2
Copy link

sou2 commented May 18, 2020

@bendspoons did you fix this?

@bendspoons
Copy link

Im on it, currently it works (tested with many Apps), but i have to do some things manually:

  • copy App Identifier manually to ShareExtension.h (replace dynamic placeholder)
  • change the Identifier in XCode to your.rdn.identifier_.shareextension_ (not applied automatically)
  • sometimes when running "cordova prepare" the .shareextension part is removed again (i do not know why)

Works with ios 11 till iOS 13.4 (tested iPad, iPhone X, iPhone 8)

I think i will publish the approach and instructions at the weekend, ill try to keep you guys posted here

@HarelM
Copy link
Contributor

HarelM commented Nov 6, 2020

Any chance for a pull request to this repo?
I'm also interested in removing the share ui and just directly open my app. Am I the only one?

@IllusionVK
Copy link

Hey Dominic @bendspoons, I'm wondering if you would be able to share your change as a PR ? Were you able to get it all to work reliability if not maybe some of us can help also and build on top of your work ? Cheers!

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

5 participants