SSAppURLs -


MIT
iOS
Objective-C

软件简介

SSAppURLs 可以根据 URL scheme
来检测本地设备是否装有某个App,并且可以打开某个App,可以传递参数。比如打开Safari或者Chrome浏览器,可以传递要打开的网址。

示例代码:

#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"];