Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Danneman101

macrumors 6502
Original poster
Aug 14, 2008
361
1
Is it possible to check if another app is installed, and if so open it. And if not, go to iTunes to get it?

How would I go about doing that?

At the moment I know how to open Safari from my obj-c code using:
Code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.mysite.com"]];
 
You can't have your app know which other apps are installed with the SDK (you can if you Jailbreak).

If an app has a registered URL Scheme, then you can launch an app that way, TwitterFon does this, TeeShot I believe does this. But I'm not sure what happens if you try to launch via an app URL Scheme if the app is not installed.
 
Sorry to be unclear: Actually, Im not trying to find any other program. I have a series of apps that should open one after another. And if the iphone recognises that the app isnt installed, it should go to itunes to get it/check it out. So I should be able to define which program Im looking for in advance.

Is it more feasible that way?
 
The only way to open another app is if that app has registered a URL schema. If that app is not installed (so the schema for that app is not registered) then when you use openURL: it should fail (I hope). This will tell you the other app is not installed.
 
as of 3.0, you have the .canOpenURL property of the UIApplication, which tells you upfront whether your openURL attempt will be successful or not. this way you can keep your application alive.
 
Will probably be a welcome addition. However, it was pretty easy getting it working with URL Schemes - very easy, in fact :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.