zoukankan      html  css  js  c++  java
  • 判断ios设备能不能打电话及发邮件发短信

     


    //1、调用 自带mail

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]];



    //2、调用 电话phone

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]];



    //3、调用 SMS

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]];



    //4、调用自带 浏览器 safari

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.hzlzh.com"]];



    //调用phone可以传递号码,调用SMS 只能设定号码,不能初始化SMS内容。
    //该代码片段来自于: http://www.sharejs.com/codes/objectc/5860

     //示例打电话

    //UIAlertViewDelegate

     

    -(void)callPalmShop{

     

    NSString *deviceType = [UIDevice currentDevice].model;

    //NSString *deviceType = [UIDevice currentDevice].modellocalizedModel;

    if([deviceType  isEqualToString:@"iPod touch"]||[deviceType  isEqualToString:@"iPad"]||[deviceType  isEqualToString:@"iPhone Simulator"]){//

    /*

    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"您的设备不能打电话" delegate:nil cancelButtonTitle:@"好的,知道了" otherButtonTitles:nil,nil];

    [alert show];

    [alert release];

    */

    [LoadingViewshowLoadingView:@"您的设备不能打电话"];

    return;

    }else {

     

    UIAlertView *infoAlert = [[UIAlertViewalloc] initWithTitle:@"提示"message:@"您确定要打电话给他吗"delegate:selfcancelButtonTitle:@""otherButtonTitles:@"",nil];

    infoAlert.tag = 200;

    [infoAlert show];

    [infoAlert release];

     

    //[LoadingView showLoadingView:@"您确定要打电话给他吗"];

    }

    }

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

     

    if (alertView.tag == 200) {

    if (buttonIndex == 0) {

     

    }else if (buttonIndex == 1) {

    [[UIApplicationsharedApplication] openURL:[NSURLURLWithString:@"tel://4006601609"]];

     

    }

    }

     

    }

  • 相关阅读:
    HDFS、YARN、Mapreduce简介
    List<object> 转 List<T>
    CTR+A组合键 以及终止按键事件传递
    BackgroundWorker 的输入、输出参数、进度条与文字刷新、取消机制、返回事件
    读取Excel文件的两种方法比较 以及用NPOI写入Excel
    浅复制不能传递,重新赋值就重新浅复制
    gridControl添加右键菜单
    C#设置Excel行高、列宽
    任意字符串(包括空串)都包含空白字符串
    JAVA 在程序中存储和修改信息
  • 原文地址:https://www.cnblogs.com/jiangshiyong/p/2540343.html
Copyright © 2011-2022 走看看