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: File Not Received While App is in Background + Background Task Assertion #106

Open
michaellavender opened this issue Jul 6, 2020 · 0 comments

Comments

@michaellavender
Copy link

michaellavender commented Jul 6, 2020

So after struggling with getting everything set up correctly I finally have this working so that I can send a file on iOS and it's received by my app, BUT the event handler is only called when I switch back over to my app and until I do that the sent file is sitting in limbo.

Running in debug mode against my phone from Xcode I can see that the plugin initialized successfully, and nothing is logged indicating an issue. I switch over to Photos and do the open-with action and select my app, then I get the dialog showing the selected image and can enter a message. I tap Post and the window closes, but my handler is not invoked. It's only when I switch over to my app that I get the following:

[ProcessSuspension] 0x######## - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background  
[ProcessSuspension] 0x######## - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background  
intent received  
...  
THREAD WARNING: ['OpenWithPlugin'] took '776.545898' ms. Plugin should use a background thread.

Similarly, if my app isn't running and I use the open-with action from Photos it doesn't cause my app to open. When I then run my app in debug mode using Xcode it picks up the message once the app loads, but logs the following warning:

THREAD WARNING: ['OpenWithPlugin'] took '57.57021' ms. Plugin should use a background thread.  
openwith initialized  
intent received  
...

The 'openwith initialized' message is one I'm logging in the success callback of cordova.openwith.init

After either switching to my app or starting it running the phone immediately switches me back over to the Photos app, away from my app even though it only activated my app when I switched over to it or started it running.

I'm really hoping I'm doing something incorrect here and that the plugin should be activating my app if it's not running or is in the background to process the openwith handler. The communication does seem to be happening and the App Group, etc., seem to be properly configured because it's capable of sending and receiving the file, but having to manually activate / run the app in order to get it receive the sent file isn't really practical because for the user it seems like they sent their file, but nothing happened.

This is using version 2.0.0 of the plugin and I'm running Xcode 11.5 and iOS 13.5.1 on an iPhone.

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

1 participant