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

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.

Related

What's the best way to create a custom sharing method on iOS?

A streaming app that I'm using on iOS has a share button that allows me to hook into the sharing app extension. I'd like to be able to send the URL string that it has to a custom API on my server.
Would I need to create an entire app just to have that custom sharing method, or is there another way?
If that's the only way, how can I get that app on my phone without going through the store?
It seems like when I create, build and install apps through Xcode, Apple intentionally breaks the app after a short while?

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

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?

Upload files from dropbox/box account to a public cloud using an iphone app

I need to transfer files from the drop box account directly to a public cloud without downloading the files and storing it in the application sandbox. Does Apple allow this?
I am looking at the same and did not find it. It should not be due to Apple allowing or not; but dropbox app does not have the function. E.g. to send a photo from dropbox, sharing function only sends a link in my apple mail.
Only possible solution I am exploring is using airfile (not sure of other apps AFAIK now), clicking on sharing allows me to open it in other app (buggy 4 my test nw) or to send via email.. send via email sounds ok since i can select photos in airfile, see the actual pic in the apple mail and send it via to flickr.
Hope that idea helps!

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

If a UIWebView displays a remote page with a username/password then can the native code tell if/when it has been validated?

I have a requirement for an app to communicate with a server, this communication is done using a proprietary http based protocol and the app uses NSUrlConnection for this.
However before the app can be used the user must first perform a one-off registration, and the requirement is that this is done by them logging onto a web page which will be downloaded and displayed in a UIWebView. As a UIWebView is used I no longer have access to the HTTP header/body nor the NSURLConnectionDelgate etc. for this part of things.
My question is, how can the app know if and when the user has successfully logged onto the web site?
It sounds like you want to implement some code in the connection:didReceiveAuthenticationChallenge: method of the NSURLConnectionDelegateProtocol. There's more information about how to respond to a challenge here.

Resources