How to share data between applications? - ios

I have previously developed on Android but never on iPhone so my question could be stupid for iPhone developers.
Does it exist one or several ways to share data between applications on iPhone ?
In Android, data sharing between applications could be performed thanks to ContentProvider.
I found a post ( How to share custom data between iPhone applications? ) that talks about URL scheme but it seems only usable to share small piece of data.

Your conclusions based on the question you linked to are correct; there's no way for iPhone applications to communicate like on Android. As mentioned, you can send information from one app to another via the URL scheme, or you may share some Keychain information amongst your own apps if you sign them properly.

No - iPhone apps are sandboxed and cannot share information. The few exceptions are that you can access information from some of the Apple apps such as the photo library, calendar, email and contacts.

It depends on what you want to share, if it is contained in a document for example, then if another application supports the document format, then you can impliment a control in your application that will allow you to open it in another app. i think it is a UIDocumentController, or UIDocumentInteractionController.
Im not 100% on the class name but good reader uses this method as does iBook, to open PDF files from another application.

Related

How to access 3rd party TvProvider on rooted device?

My question is a follow up to this question.
Let's assume I have an Android Tv stick, I also am the vendor. There are 3rd party apps like Netflix, Prime, etc. I want to access the channels provided via TvProvider or ContentResolver. As pointed out in one comment:
apps vendors signs with the same key as an AOSP itself
placed them in a special folder - only vendors of devices can do it
or you, but only on rooted devices
How are my possibilities for the options above?
Using one of the proposed options you will be able to get all channels from the TvProvider inside the apps with signature /signatureOrSystem protection level. I don't know the specifics but I assume they may be different for different ROMs you may use. You will be able to retrieve the data from TvProvider the same way you are able to do it in your own app - this answer has links to examples from Android system app.
You will be able to render Rows from the data via leanback library in your own app(I don't know whether it should be a launcher or just an app). After the user by clicking on a card will enter the app that provided the content and view it there. You will not be able to view the videos inside your own app even if it is a system one because you would have to have access to the backend of the app that provided the media and that information is not stored in the TvProvider. The media inside a TvProvider is rather a simple link to a content page inside the other app.
There is plenty of info online about modifying ROMs, creating signatureOrSystem apps I cannot dive a specific link because I cannot verify its validity, because I haven't tried to do such things with TvProvider in specifics and Android OS in general(except for the root and disassembling and modifying already existing apps from the device vendor - also plenty info online).

iOS - Retrieve the most visited websites on the device

I am developing a mobile app in objective-c for iOS.
Is there a way inside my app to programmatically retrieve the most visited websites from the browsers on the device?
I am interested in the urls specifically (e.g. "http://www.google.com"), in order to check a couple of things.
I've searched online but I haven't find anything that could satisfy these needs: does every browser save this kind of information in a private folder not accessible to anyone else and so it's not possible to get this data? Or am I missing something else?
Thanks anyway for your answers
The answer is: No, it's impossible. Apple doesn't give as an API to do that.
No, the developed applications are sandboxed. You can't access data out of one app from another. It's part of the security model.
Apple didn't published APIs for this privacy access level, It only published the following APIs for Safari extensions:
https://developer.apple.com/documentation/safariservices/safari_app_extensions
BTW, This question is asked alot before, you can check them:
how to programmatically access iphone browser history
How to access iPhone Safari History in an App?

How to read content of an iOS app from another app?

I am stuck somewhere. My client wants me to develop an application that has a dedicated icon over other applications as well. For example – If I have an ecommerce application opened in my iPhone, there should be an icon over that application through which I can take screenshot and add the image to my application. I know this is possible in android, but is it possible in iOS as well, if yes then how?? Also refer the image attached for more clarification.
Share data between two applications
Historically, the iPhone has tried to prevent data sharing between apps. The idea was that if you couldn't get at another app's data, you couldn't do anything bad to that app.
In recent releases of IOS, they've loosened that up a bit. For example, the iOS programming guide now has a section on passing data between apps by having one app claim a certain URL prefix, and then having other apps reference that URL. So, perhaps you set your event app to answer "event://" URLs the same way that a webserver answers for "http://" URLs.
Have a peek under "Implementing Custom URL Schemes".

Is it possible to get info on other installed iOS apps?

Is it possible to read the contents of another application installed on an iPhone? What about from an extension or keyboard?
I'm trying to come up with something that 'checks' other apps to see if they have any deep links (like Twitter's Twitter://timeline that takes users straight to the timeline in the Twitter app).
Is there any smart way to check a given app for deep links?
Is it even possible to peek at another app's contents from within my app? I suspect no.
If no, what about making a keyboard or extension of some sort that I can access from an app like Twitter and see its contents, such as a URL deep link?
You don't have much options, you may use -canOpenURL:, but, since iOS9, must include special credentails listing all the custom schemes you want to check.
You can't read other app's contents on a non-rooted device unless this app is sharing a keychain (so it can exchange data via the shared keychain). The same thing goes with extensions.
iOS has some high bars on security, so, don't expect much or even, anything.
Something you may want is IntentKit. Also there are ideas around the web about standard url query format like MobileDeepLinking.

How to share a link from the app using other applications

I want to share a link from my app using other applications installed on my iPhone such as Gmail, Facebook, DropBox, WhatsApp etc. In android there is a straight way to do so, just fire an intent and it automatically shows the installed apps through which we can share whatever we want. Is there any such way in iPhone ?
Thanks!
On iOS , app is more separated from each other. The only way to pass data from one app to other is using the URL mechanism. As one example, an app register url scheme "open-me://",you invoked openURL with "open-me://my-link" then that app will launched. That app will define the detail of the URL so it could understand the content.Continue with the example we are using, the text you passed could be either "open-me://A?data=my-link" or "open-me://A?message=my-link". So there are no general solution for all apps.Typically third party app will provide a SDK to make these things easy.
If you don't mind using a kind of large third party library, ShareKit is a good choice. It supports quite some apps.
If you want to know more about this topic,for example sharing files between app. You could start from reading the class reference of UIDocumentInteractionController.This UI component will show a list of app installed on your device which support the URL scheme.

Resources