//跳转到微信
- (void)callWeChat:(NSString*)Weixin {
if([self isWeChatInstalled]) {
NSString* qqUrl = [NSString stringWithFormat:@"weixin://"];
UIWebView* webview = [[UIWebView alloc]initWithFrame:CGRectZero];
[[UIApplication sharedApplication].keyWindow addSubview:webview];
NSURL*url = [NSURL URLWithString:qqUrl];
NSURLRequest*request = [NSURLRequest requestWithURL:url];
[webview loadRequest:request];
}
}
- (BOOL)isWeChatInstalled{
NSString*urlStr = [NSString stringWithFormat:@"weixin://"];
NSURL*url = [NSURL URLWithString:urlStr];
if([[UIApplication sharedApplication]canOpenURL:url]){
NSLog(@"已安装微信了");
return YES;
}
else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"尚未安装微信" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alert show];
return NO;
}
}