Posts

Post not yet marked as solved
1 Replies
339 Views
Hi all, I'm working on an app where the core mechanic is to share a URL from a browser to the app. Based on the URL being shared, we enrich some details using a network request which can take 3-10 seconds to load (or more). Currently, we do the following: Load the share extension Make the enrichment request Make the user wait for the result Enable the "share" button when the result is present. Update application state #3 is problematic because it takes our users out of their primary activity and makes them wait on us. We would much rather do the following: Load the share extension User clicks "share" Kick off the enrichment request Enrichment requests completes and updates application state in the background. I've gotten the above to work just fine in testing with background sessions, but we can't ship it because only one can run at a time and if a user shares another URL before the first has returned, the session is invalidated and only the new URL will complete and update application state. This post was helpful during troubleshooting to figure out what was going on with cancelled requests, but it seems that what we're trying to do may not be supported. I've thought about other mechanisms that get us our desired effect, but each comes with drawbacks: Kick off a server side request as a job in the share extension, then send a data-only push notification back to the device when the data enrichment is complete. Downside is it adds complexity server-side and we have to request notification permission. Pop the URLs into some sort of queue in the shared container and process them incrementally with a background fetch. Downside here is that we're not in control of the timing and could only get through a few of these requests in the time we have allotted. Janky UX because there becomes an appearance of taking many minutes to enrich, instead of the reality of relatively short processing time but long waiting times between batches. Any prior experience, thoughts, or advice on how to architect this workflow? I'm relatively new to iOS development, so please feel free to point out anything obvious that I may be missing or misunderstanding! Thanks, Jonathan
Posted Last updated
.