Reputation: 1281
My application have iOS OpenVPN Connect app dependency.
So I have to check if the app is already installed or not
if so I will just Open the app using OpenURL scheme else I will open its appstore link so that user will install it.
So my problem here is I couldn't find any open url associated with this app.
Any help is appreciated !
Upvotes: 4
Views: 3066
Reputation: 4178
Support for openvpn://
URL scheme was introduced in OpenVPN Connect 1.0.6
, according to OpenVPN Connect FAQ you can use this code:
BOOL installed = [application canOpenURL:[NSURL URLWithString:@"openvpn://"]];
Following code opens iTunes
to install OpenVPN Connect if it is not installed yet:
UIApplication * app = [UIApplication sharedApplication];
BOOL installed = [app canOpenURL:[NSURL URLWithString:@"openvpn://"]];
if (installed) {
[app openURL: [NSURL URLWithString:@"openvpn://"]];
} else {
[app openURL: [NSURL URLWithString: @"https://itunes.apple.com/app/id590379981?mt=8"]];
}
EDITED: actually this approach DOES NOT work, I have just tested myself - the matter is that published version of OpenVPN Connect in AppStore is 1.0.5, so this feature is not available in it ((
Upvotes: 0
Reputation: 5186
I think you want to open "openvpn ios" application from your application. Please check the below link for same :
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/
Follow the steps as it said and check whether application is opened or not.
Upvotes: 0
Reputation: 3454
Whilst it might sound cheeky, I think one way would be to email the developers and ask them if they have a URL scheme, or if they would create support for one. Its a win-win because their software is more likely to be installed if it can be leveraged in new ways, and you'd get the functionality you need.
Upvotes: 1
Reputation: 50089
it exports a doctype. so you could use a UIDocumentInteractionController to check if the filetype can be opened and thus the app is installed.
uti is net.openvpn.formats.ovpn
copy a file of that type (you can make such a file on OSX) to the bundle and attempt to present an interaction controller for it using presentOpenInMenuFromRect
set yourself as delegate and if it fires willShowMenu, then you no the app is there - and you dismiss the menu.
so to get you started something like this:
NSString *file = ... //path to file with UTI in question
UIDocumentInteractionController *c = ... //init with file
c.delegate = self;
_hasAppInstalledForUTI = NO;
[c present...];
if(!_hasAppInstalledForUTI) {
//act
}
...
- willPresentOpenInMenu {
[c dismissAnimated:NO];
_hasAppInstalledForUTI = YES;
}
BTW: I checked the app -- there is no url scheme.
Upvotes: 1
Reputation:
To check if the user has the app at all, you would do the following:
NSURL *url = "appScheme://"
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
else {
// can't open url
}
But not all apps have url schemes. I know mine don't.
If you are not able to find any online, then chances are there isn't one. Try to contact the developers to find out if there even is one to begin with, otherwise try finding another app that has one, and use that one instead.
Upvotes: 0
Reputation: 2084
You try to open an .ovpn
file.
Here's an old question from myself to get you started on how to do that.
Though this is not specifically check that particular app, but it should do the job.
Upvotes: 0