Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ios

  1. 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).

  2. 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?

  3. Is it possible for an app to create a new process in addition to a new thread (I guess not)?

like image 966
Gruntcakes Avatar asked Jan 19 '23 01:01

Gruntcakes


2 Answers

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.

like image 152
Tommy Avatar answered Feb 05 '23 09:02

Tommy


  1. 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)

  2. 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.

like image 26
rajagp Avatar answered Feb 05 '23 07:02

rajagp