iOS评分功能、APP中打开其他应用程序

1、评分功能

iOS中评分支持功能开发非常简单。

NSString *str = [NSString stringWithFormat:  

@"itms-apps://itunes.apple.com/cn/app/id%@?mt=8", appid];  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; 

只需要这么两行就可以啦,它就会跳转到AppStore的应用位置去咯。

2、打开其他应用程序

在程序中打开其他应用程序,需要先设置被打开应用的scheme。

例如我们在自己做的APP 1中设置scheme,设置方法如下:

然后在自己的APP 2中添加代码:

// 1.根据模型拼接url  

//"scheme://identifier"  

NSString *path = [NSString stringWithFormat:@"%@://%@", product.scheme, product.identifier];  

NSURL *url = [NSURL URLWithString:path];  

// 2.判断能否打开应用  

UIApplication *app = [UIApplication sharedApplication];  

if ([app canOpenURL:url]) {  

// 2.打开应用程序  

[app openURL:url];  

}else  

{// 没有安装应用程序就跳转到AppStore  

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: product.url]];  

判断本地是否安装要打开的应用:[app canOpenURL:url]

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容