NSURL(FWApplication)
@interface NSURL (FWApplication)
第三方URL生成器,可先判断canOpenURL,再openURL,需添加对应URL SCHEME到LSApplicationQueriesSchemes配置数组
-
生成苹果地图地址外部URL
Declaration
Objective-C
+ (nullable NSURL *)fw_appleMapsURLWithAddr:(nullable NSString *)addr options:(nullable NSDictionary *)options;
Parameters
addr
显示地址,格式latitude,longitude或搜索地址
options
可选附加参数,如@{@“ll”: @“latitude,longitude”, @“z”: @“14”}
Return Value
NSURL
-
生成苹果地图导航外部URL
Declaration
Objective-C
+ (nullable NSURL *)fw_appleMapsURLWithSaddr:(nullable NSString *)saddr daddr:(nullable NSString *)daddr options:(nullable NSDictionary *)options;
Parameters
saddr
导航起始点,格式latitude,longitude或搜索地址
daddr
导航结束点,格式latitude,longitude或搜索地址
options
可选附加参数,如@{@“ll”: @“latitude,longitude”, @“z”: @“14”}
Return Value
NSURL
-
生成谷歌地图外部URL,URL SCHEME为:comgooglemaps
Declaration
Objective-C
+ (nullable NSURL *)fw_googleMapsURLWithAddr:(nullable NSString *)addr options:(nullable NSDictionary *)options;
Parameters
addr
显示地址,格式latitude,longitude或搜索地址
options
可选附加参数,如@{@“center”: @“latitude,longitude”, @“zoom”: @“14”}
Return Value
NSURL
-
生成谷歌地图导航外部URL,URL SCHEME为:comgooglemaps
Declaration
Objective-C
+ (nullable NSURL *)fw_googleMapsURLWithSaddr:(nullable NSString *)saddr daddr:(nullable NSString *)daddr mode:(nullable NSString *)mode options:(nullable NSDictionary *)options;
Parameters
saddr
导航起始点,格式latitude,longitude或搜索地址
daddr
导航结束点,格式latitude,longitude或搜索地址
mode
导航模式,支持driving|transit|bicycling|walking,默认driving
options
可选附加参数,如@{@“center”: @“latitude,longitude”, @“zoom”: @“14”, @“dirflg”: @“t,h”}
Return Value
NSURL
-
生成百度地图外部URL,URL SCHEME为:baidumap
Declaration
Objective-C
+ (nullable NSURL *)fw_baiduMapsURLWithAddr:(nullable NSString *)addr options:(nullable NSDictionary *)options;
Parameters
addr
显示地址,格式latitude,longitude或搜索地址
options
可选附加参数,如@{@“src”: @“app”, @“zoom”: @“14”, @“coord_type”: @“默认gcj02|wgs84|bd09ll”}
Return Value
NSURL
-
生成百度地图导航外部URL,URL SCHEME为:baidumap
Declaration
Objective-C
+ (nullable NSURL *)fw_baiduMapsURLWithSaddr:(nullable NSString *)saddr daddr:(nullable NSString *)daddr mode:(nullable NSString *)mode options:(nullable NSDictionary *)options;
Parameters
saddr
导航起始点,格式latitude,longitude或搜索地址
daddr
导航结束点,格式latitude,longitude或搜索地址
mode
导航模式,支持driving|transit|navigation|riding|walking,默认driving
options
可选附加参数,如@{@“src”: @“app”, @“zoom”: @“14”, @“coord_type”: @“默认gcj02|wgs84|bd09ll”}
Return Value
NSURL