Sharing Data Between Apps on an iDevice - ios

Is it possible to share on-disk data between iOS applications, or are they truly sandboxed? In other words if I wanted to make a shared repository of data to be accessed (and/or modified) by one or more of my apps, could it be done?
One of the listings on the iOS features page is "Share Data Among Apps", but is this what I'm looking for, and what are the related APIs?
Googling hasn't turned up much else in this area and I know I can construct a path to just about anywhere in the iDevice directory structure. Would it be against Apple's TOA, leading my apps directly to rejection, or is there hope for such an architecture?

Nothing too easy unless your app is iPad only. Otherwise this thing speaks about URL Prefixing. See "Implementing Custom URL Schemes" http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html%23//apple_ref/doc/uid/TP40007072-CH4-SW7.
Here is some info on the iPad only Doc support: http://developer.apple.com/library/ios/#documentation/General/Conceptual/iPadProgrammingGuide/CoreApplication/CoreApplication.html%23//apple_ref/doc/uid/TP40009370-CH6-SW2 see "Document Support on iPad Devices". This DOES NOT work on iPhone/iPod

That looks like marketing speak. The only way to share data locally is to pass it in the URL when launching another app. Otherwise, you need an internet server based solution.
Another thought: can you use TCP locally between apps with the new multitasking support? Apps like Air Sharing are allowed to create listening sockets.

using ios keyChain you can share data between apps.

Related

How to allow app to use Mobile Data in xcode

I'm a beginner in iOS. I'm making an app that works both offline and online. On the default Settings app on iOS, my app has only access to Notifications and background App Refresh. How do I add the option to allow users to use mobile data?
Thanks!
It's enabled by default - you don't have to do anything. The option will appear in the Settings page the first time you use mobile data with your app.
When starting a basic project on Xcode your application by default is routed to work with cellular data. There is no need for any kind of external settings manipulation. If you really feel like configuring the overalls and the connection structures feel free to explore the " Networks " tab to better optimise your app.
And good luck with your new project !
I just build an app in Xcode 14 and mobile data was off by default!

Firemonkey iOS access one file from different apps

I am writing multiple apps for iPad. All these apps have some settings in common. I therefore would like to have one app that handles the settings and write them to a file - the respective apps will then retrieve their settings from this single file. Is there a way to access one file from different apps on iOS?
The iOS Keychain may help -> http://shaune.com.au/ios-keychain-sharing-data-between-apps/ though a Google search for FireMonkey APIs for the keychain has proven fruitless. At least it could be a starting point.

Is there a way to query what other apps are on a device

Does iOS offer a way for an app to query the device for information about what other apps are installed/running?
All ios apps are sandboxed so this wouldn't be possible on a non-jailbroken device
There are a few options.
First, you can lookup for the specific process name of the app, but this may be prone to error as unrelated apps may be running using the same process name, for example, I've seen both the Batman and Dark Meadow game share a similar process name: UDKGame.
Secondly, using the URL scheme. This method is useful if you know what apps you are looking for and you know that this particular app implements the URL scheme. You can do a simple canOpenURL and find out if that app is installed.
I use the second method a lot to collect the URL schemes for use in my app, AppSwitch.

PhoneGap in regards to App Store approval

I read that PhoneGap is approved by Apple as a framework for building native apps, but I'm not clear on how this does not constitute a "website wrapped as an app," something that Apple specifically doesn't like, as per their App Store guidelines. I'm assuming it is because the JS is contained in the application, rather than running on a remote server?
Any clarification on this issue would be most appreciated.
but I'm not clear on how this does not constitute a "website wrapped
as an app," something that Apple specifically doesn't like, as per
their App Store guidelines.
By this Apple means Apps that simply show a UIWebView that loads a remote website, so it basically just behaves like Mobile Safari, just without the controls. Also they wan't Apps to show at least a UI when the device is not connected to the internet, like in the Facebook App where you can still read already downloaded status updates, view photos etc. That's what a "I just wrap a remote website inside a UIWebView"-App can't do.
PhoneGap Apps have all the resources they need (HTML, CSS, JavaScript) on the device residing in the App's bundle, so using such an App would not depend on network availability and could at least show a UI that tells you to connect to the Internet in order to use the App, or they could display already loaded content (like Facebook, Twitter and so on).
I think that the signature of the binary tells Apple what framework built the application, and since all the supporting files (js included) are included in the project and therefore in the binary, it is a standalone application. That being said, I still think that doing things Natively is the best way to go. I am extremely comfortable with javascript and started out thinking Phonegap was the way to go for me. I did a couple of projects with it and then decided to take the plunge and learn Objective-C. That worked out so much better for me. No dependency on a third party framework and I wish that I had started that way.
Sometimes the easy way out just hurts ya in the end IMO.

Does iOS have any equivalents to DLLs/IPC/process spawning?

Are separate apps able to share the same binary in a form like a DLL? I know its possible to compile static libraries but I wouldn't count these as the same as a DLL (i.e. a dll is one copy of a binary shared by multiple apps, whereas static libraries are separately included by any using app).
Is each app totally separate from each other, are there any IPC or file sharing mechanisms available for differing apps to communicate and share data?
Is it possible for an app to create a new process in addition to a new thread (I guess not)?
You can't share executable files between applications. Apple requires that all apps function standalone. However you can use a UIDocumentInteractionController to get another program to deal with files you don't understand, and a 'quick view' may be available. That's how Mail works, for example.
Programs from the same vendor can share the keychain and, I think, iCloud storage as of iOS 5, but can't share storage on disk. As they can declare supported file types, UIDocumentInteractionController can be used to push temporary access to a file from one app to another. A custom URL scheme can be used in a similar way to pass fragments of data if that helps.
As a general rule, only one user process may be active at once in iOS - e.g. background processing is essentially event based. So you can't create a second process for yourself.
You can do this if you are developing for a jailbroken phone. Not
otherwise.On jailbroken phones, you can create .dylibs or shared libraries that can be
loaded via the DYLD_INSERT_LIBRARIES environment var (much like on
MacOS)
Apps are sandboxed. However, there are some ways of communicating between apps. You can use
(a) customURL scheme (also mentioned by Tommy above)
(if any) associated with an app to launch an app and send some
parameters to the launching app
(b) If you control communicating
apps, then you can use Message ports (CFMessagePortCreateRemote)
(c) If you control communicating apps, you could use Darwin
NOtification center for distributed apps.
Of course the expectation for (b) and (c) is that the
communicating apps are all running. On iOS since there is only one foreground
process, you'd have to have the other as a background app and that's
restricted to certain kinds of apps on the iOS platform.
Basically, no to all of the above, unless you're targeting jailbroken phones and are bypassing Apple's App Store. If you jailbreak, I believe you have similar options to those you have in Mac OS X.

Resources