Reputation: 87
I want to know what the bundle version/id in my current app of an extern application on an iOS device. How can I achieve this?
Upvotes: 1
Views: 209
Reputation: 8337
If the other application is developed by you, you can use custom URL schemes to determine whether a specific version is installed.
For each version that you want to check against, you'll have to add a URL scheme to your other app. The idea is that the URL schemes only contain a URL scheme for the current and previous versions.
Version 1.0 would only have com.you.your-other-app.1.0
.
Version 1.2, however, then has two or more URL schemes: com.you.your-other-app.1.0
and com.you.your-other-app.1.2
.
You can then check if a specific version of that app is installed in any app using the following:
BOOL is10Installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"com.you.your-other-app.1.0://"]];
BOOL is12Installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"com.you.your-other-app.1.2://"]];
Update:
I use this in two of my apps that communicate between each other in order to determine whether a specific feature is supported or not. This can be quite useful.
Upvotes: 2
Reputation: 8371
You're in a App Sandbox. You can't communicate with other apps than yours.
To get the Version of your running app:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
Upvotes: 2