iOS 跳转到评论详情、弹出电话、跳转到QQ、跳转到微信、跳转到
2017-05-21 本文已影响162人
透支未来
跳转评论、详情
// 跳转到详情
NSString *str = [NSString stringWithFormat: @"itms-apps://itunes.apple.com/cn/app/id%@?mt=8", AppId];
UIApplication *app = [UIApplication sharedApplication];
NSURL *url = [NSURL URLWithString:str];
if ([app canOpenURL:url]) {
[app openURL:url];
}
// 跳转到评论
NSString *str = [NSString stringWithFormat: @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@", AppId];
UIApplication *app = [UIApplication sharedApplication];
NSURL *url = [NSURL URLWithString:str];
if ([app canOpenURL:url]) {
[app openURL:url];
}
弹出电话
/**
* 客服电话
*/
@property (nonatomic, strong) UIWebView *webView;
- (UIWebView *)webView
{
if(!_webView)
{
_webView = [[UIWebView alloc] initWithFrame:CGRectZero];
}
return _webView;
}
// 客服电话
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", self.lbl_Telphone.text]]]];
跳转QQ
// 跳到QQ
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web", self.qq]];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
跳转到微信
// 跳到微信
NSString *str =@"weixin://qr/JnXv90fE6hqVrQOU9yA0";
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
跳转到微信公众号
注:跳转到微信公众号,首先需要到微信开发平台,绑定对应的公众号
if ([WXApi isWXAppInstalled]) {
JumpToBizProfileReq *req = [[JumpToBizProfileReq alloc]init];
req.username = @"公众号原始ID";
req.extMsg = @"";
req.profileType =0;
[WXApi sendReq:req];
} else {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setString:self.weChatID];
[QQMMessage showSuccessMessage:@"已复制公众号"];
}