Quickly check for and open URLs using iOS app URL schemes.
Quickly check for and open URLs using iOS app URL schemes.
SSAppURLs
is a tiny UIApplication
category that makes it easy to:
SSAppURLs
, along with SSPreferredBrowser, powers various URL actions and open-in-browser behavior in my app MUDRammer - A Modern MUD Client for iPhone and iPad.
Install with CocoaPods. Add to your Podfile
:
pod 'SSAppURLs', :head # YOLO
Check out Example
for an app example.
#import <UIApplication+SSAppURLs.h>
// Does the current device have skype installed?
BOOL deviceSupportsSkype = [[UIApplication sharedApplication]
canOpenAppType:SSAppURLTypeSkype];
// If so, let's make a call!
if (deviceSupportsSkype) {
[[UIApplication sharedApplication] openAppType:SSAppURLTypeSkype
withValue:@"415-555-1212"];
}
// Does the current device have Chrome installed?
BOOL deviceHasChrome = [[UIApplication sharedApplication]
canOpenAppType:SSAppURLTypeChromeHTTP];
// If so, open a website in chrome!
if (deviceHasChrome) {
[[UIApplication sharedApplication] openAppType:SSAppURLTypeChromeHTTP
withValue:@"http://www.splinesoft.net"];
}
// Check for an arbitrary scheme type
BOOL deviceHasTelnetApp = [[UIApplication sharedApplication]
canOpenAppWithScheme:@"telnet"];
// Let's play NANVAENT!
if (deviceHasTelnetApp) {
[[UIApplication sharedApplication] openAppWithScheme:@"telnet"
withValue:@"nanvaent.org:23"];
}
SSAppURLs
is a @jhersh production – (electronic mail | @jhersh)