void CallPhone(const char* iphone){
NSString *nsIphone =[NSString stringWithFormat:@"tel://%s",iphone];
NSLog(nsIphone);
NSURL* url = [NSURL URLWithString:nsIphone];
NSString *version = [UIDevice currentDevice].systemVersion;
NSLog(version);
if(version.doubleValue>10.0){
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}
else{
[[UIApplication sharedApplication] openURL:url];
}
}
一键加群
拿key的方法参考https://blog.csdn.net/weixin_44806700/article/details/123223471
需要在Xcode的Info.plist中添加
在Unity中可以通过实现IPostprocessBuildWithReport接口实现打包完成后自动设置
void JoinQQGroup(const char* key,const char* uid)
{
NSString * nssKey = [NSString stringWithUTF8String:key];
NSString* nssuid = [NSString stringWithUTF8String:uid];
NSString *urlStr = [NSString stringWithFormat:@"mqqapi://card/show_pslcard?src_type=internal&version=1&uin=%@&key=%@&card_type=group&source=external&jump_from=webapi", nssuid,nssKey];
NSURL *url = [NSURL URLWithString:urlStr];
//首先判断是否能打开这个URL
if([[UIApplication sharedApplication] canOpenURL:url])
{
//在判断系统版本号
NSString *version = [UIDevice currentDevice].systemVersion;
if(version.doubleValue>10.0){
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}
else{
[[UIApplication sharedApplication] openURL:url];
}
}
else{
//打不开这个URL提示错误
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"出错" message:@"打开QQ出问题了" preferredStyle:UIAlertControllerStyleAlert];
//创建按钮
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){
}];
[alertController addAction:cancel];
while(alertController.presentedViewController)
{
}
[UnityGetGLViewController() presentViewController:alertController animated:YES completion:^(){}];
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)