Closed ygyg70 closed 4 years ago
Ditto. Trying to dig in to figure out what's going on but I'm not an iOS dev so I don't know enough about the app lifecycle to really figure out what's going on. What it seems is that the invisible window (layer? layout? storyboard?) is blocking the rest of the app. I put on DEBUG level logging, and didn't learn anything new. Still digging to see what I can find!
I got it! Here's what you need to change:
In XCode, open under your project, ShareExtensions/ShareViewController.m
https://github.com/EternallLight/cordova-plugin-openwith-ios/blob/master/src/ios/ShareExtension/ShareViewController.m#L154 Find viewDidAppear What the block of code looks like now is:
(void) viewDidAppear:(BOOL)animated { [self.view endEditing:YES]; }
(void) viewDidLoad {
What you want to do is basically move the viewDidLoad content to the viewDidAppear body. So remove the closing } of viewDidAppear and the `- (void) viewDidLoad {` so that the two methods are merged, and the whole thing loads/runs within viewDidAppear. You end up with
(void) viewDidAppear:(BOOL)animated { [self.view endEditing:YES]; [self setup]; [self debug:@"[viewDidLoad]"];
if you want to be correct, change the debug statement to viewDidAppear instead of viewDidLoad. But whatever!
Doing that solves the problem. You still see a brief flash of the share dialog on the second share as it's switching to your app, but that's a-ok with me for now.
Here's my PR for the fix. If you look at the diff, you'll see the changes: https://github.com/EternallLight/cordova-plugin-openwith-ios/pull/13
Tried and seems to work for me :) Would be nice if someone proficient with iOS would review the change...
Thank you. I was having issues with the iOS Files app freezing when I attempted to share items from there, as well. This fixed it.
PR isn't getting merged by repo owner. If you want to use my working version, you can do cordova plugin add https://github.com/grexican/cordova-plugin-openwith-ios.git
to pull from mine.
FWIW I'm currently using @ygy6g70 's repository at https://github.com/ygyg70/cordova-plugin-openwith.git
but I'm having trouble getting it to work with android. So I might pull back and revert to using my openwith and go back to using the Web Intent package for android.
@grexican thank you very much for the suggested fix! It will be included in the version 2 of the plugin
This started happening with iOS 12 2nd time I share Safari page I get this dialog, and when canceling the Safari is frozen and I have to kill it (see attachment)