Is this possible to share data between two applications on the same device?
Or can I allow some other application to use my application's information / data or in any other way?
For example, the first application is for event management, and I use it to save some event. The second application is for reminders, which will get data from the other application in order to remind me about the event.
This is just a simple example, not a real scenario.
No. You would have to use some cloud solution.
You can use https://github.com/burczyk/Camouflage to read and write NSData to iOS Camera Roll as .bmp file and share it between apps :)
Brand new solution!
Since iOS 8 you can easily share data between apps as long as they are in the common App Group.
Apple documentation best explains it in the Extensions context: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html
Basically, you need to:
First API is based on
NSUserDefaults
:Second API is based on
NSFileManager
. It's simply a shared folder that you can access after obtaining it's url:Anything you put inside
myDefaults
or the folder pointed bysharedFolderURL
will be visible and accessible for all your apps.In case of folder, please write/read atomically just to ensure no deadlocks are possible.
From iOS 8 I've successfully Access Same folder in using "App Group Functionality." I'm extending answer of @siejkowski.
Note: It will work from same developer account only.
For that you have to follow below steps.
Now You have to create Two Apps. Sample Name
Now We are copying images from Demo_Share_One to Sharing folder which is created by default when you enable App Groups and run app. and will access all those images from Demo_Share_Two.
You have to Take Group Name which was set to your developer account.lets say
group.filesharingdemo
.Add Below method in Both apps to get Relative path of sharing folder url.
Now we are Copying Images from Bundle from Demo_Share_One
Now in Demo_Share_Two to access those images
And Now You will get all images which your write from Demo_Share_One.
So From now onwards if you want to share this folder two your third app. just add that app in your group. So it is too easy to access same elements in Your Multiple apps.
Thanks to Apple for Share Elements from your own apps functionality. Happy Coding. :)
Share data between apps possible? Yes it is!
Use UIPasteBoard available from iOS 3.0, documentation is available here. Apple docs say:
It is also possible to share data between apps in the keychain, although the data is primarily meant to be passwords and such, anything serializable could be stored. Here is a Stack Overflow question about that.
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.
Apple's documentation of that approach is here.
Have a peek under "Implementing Custom URL Schemes".