How can I pass data from app extension to host application and upload it Firebase? - ios

I am using an app extension to allow users to save webpage URLs to my app so I can display them in a UITableView. I have created the action extension but I'm especially struggling with uploading the data to Firebase. I know it is not performance-friendly to upload to Firebase from the Action Extension, so I want to send the URL back to the host app to be processed. The one question I have though -- how can I notify the host app that a new URL has been retrieved using the action extension so I can upload it to Firebase?
I was planning on using delegates and protocols, but there is no way to use them in app groups. I also have looked into MMWormhole, but I am not sure how that would work with my app's needs.
How can I notify the host app that a URL has been retrieved using the action extension so I can upload it to Firebase?

Related

Can I perform a task in Main iOS app from the app Extension?

I have an app extension for Sharing (Share Extension) and when a user selects my app to share an image, my app will send that image to a server.
The problem is that the server requires an authenticated identity (AWS Cognito) to send the object to the server. Since I cannot share Authentication from my main app to my extension and I don't want to have the user sign in every time they want to share, I'm stuck.
I can see this being done with messaging apps where a user sends a message from a share extension. I'm not sure how they achieve this. Since the user is not asked to login again in the extension, somehow the credentials are either being shared with the extension or the app is momentarily launched to perform that upload while remaining in the background (not sure this is possible).
So my question is what is the approach I should be using. Should the extension somehow be directing the main app to upload the image or should I figure a way of sharing the access tokens with the extension in a secure way and accessing them without any user action?
The solution is to setup a shared container for the app & the extension, please see "Sharing data with your containing app" section in this article: https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#:~:text=To%20enable%20data%20sharing%2C%20use,App%20to%20an%20App%20Group.

How to share Parse login session with iOS extension?

When writing an iOS extension for an app, is it possible to share the app's current Parse login session with the iOS extension?
iOS extensions are bundled with iOS apps but run in separate containers. So when the user logged in on the app, the extension cannot access that Parse instance. If the extension logged in again, it would create an additional login session for the user.
However the extension can share a common data container with the app. So I wonder if it is possible to store the PFSession.sessionToken in the shared container and let the extension communicate with Parse Server based on that existing session without having to login?
There are two possible solutions:
A) The elegant approach
Enable local data sharing which shares persistent data between the main iOS app and its extensions.
// Enable data sharing in main app.
Parse.enableDataSharingWithApplicationGroupIdentifier("...")
// Enable data sharing in app extensions.
Parse.enableDataSharingWithApplicationGroupIdentifier("...", containingApplicaiton: "...")
Local data sharing in Parse SDKs allows you do share persistent local
data between your main application and extensions that it contains,
including Keyboard, Share/Today/Photo/Action extensions and Document
Providers.
As described in the docs.
B) The manual approach
After login in the app, store the Parse session token PFUser.current().sessionToken in an ecrypted, shared data container.
The extension can then access the session token and continue the session with PFUser.become(sessionToken:).

How to send custom iMessage view with JSON data and possibility to open it in my app?

I have an app. And now I would like to share the data from one user to another via iMessage app and custom messages like this:
What I need to achieve?
share some JSON content and open it in my app if it is installed on iPhone...
JSON data should be sent from within an app directly...
is it possible?

Fetch or Push values from Parent application to Intents extension in iOS?

I am creating a SiriKit extension for my application for a payment.
I want to fetch some data from parent application & use that data to populate.
How to fetch data from Parent application ?
To share data between app and app extension, you should use App Groups.
Please refer following links:
http://www.atomicbird.com/blog/sharing-with-app-extensions
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html

share core data between many users on app

I wanna develop an iOS app as the platform for many users. Is it possible to enable multiple users of my app to share resources on the same core data database?
The other alternative to iCloud (with the whole ownership issue) is to have an online server that stores the data remotely.
Then you can create a web service to store and retrieve the data from the server onto the device.
yes This can be done using a custom url scheme on the iphone by help of iCloud URL.
but it has some dark sides.If you use a custom url scheme, only one application "owns" the data. The other application would have to import data from the main application.
another method is system pasteboard i.e. clipboard. you can put stuff on it and then launch another application with a URL that tells the other app to check the pasteboard.There's also the system pasteboard .
for more information on custom URL scheme check this link

Resources