tags:

views:

198

answers:

4

I'm writing a freeware version of an app and would like to check if a user already has the unfree version installed, and print a message whose contents are conditional on the results of the installation check... anybody know if this is possible?

the closest I've come to a solution is to make use of the CFPreferencesSetValue API with a kCFPreferencesAnyUser / kCFPreferencesCurrentHost pairing... I haven't tried it, but based on the documentation it sounds possible.

however in my current specific situation this API will not be able to solve my problem, because I want to check for the presence of an app I wrote 4 months ago that didn't write any data to the CFPrefs registry... because back then I didn't know of it nor did I foresee this situation arising... the only way CFPrefs can assist me is in future apps now that I know it exists :)

so I'm wondering if there are other ways to do it? any help will be appreciated :)

A: 

Sorry, no, there is no way for an app to find out information about any other app installed in an iPhone (without jailbreaking). Apple intentionally sandboxes the apps so they are completely isolated.

The best possible thing you could do (in the future) is register a URL handler that would launch your other app, and in turn would re-launch your current app with a parameter.

-dan

Daniel Blezek
@Dan: Contrary to what you believe, the sandbox doesn't conceal this information.
KennyTM
KennyTM, can you elaborate? is the method that bypasses a sandbox something that would get it rejected by the AppReview board?
eerok512
@eerok: That uses private API (liblockdown or GraphicsServices) so it will be rejected.
KennyTM
+3  A: 

According to this answer, if you have the same top level app id you can access your other app's data area. I believe wild-card app id's can also share data, see the provisioning portal docs.

progrmr
+5  A: 

You can register a custom URL scheme for your existing application and then call canOpenURL in your new application to detect if the application is installed.

Shaji
A: 

You can share data between applications via the keychain. Write data in the full app and check from the free one or vice versa.

Eiko