//判断能否打电话
NSString *deviceType = [UIDevice currentDevice].model;
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];
}else{
//打电话的方法
}
//判断能否发短信
1、引入MessageUI.framework
2、#import <MessageUI/MessageUI.h>
//发送短信方法
Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
<pre><span style="color:#0000ff;">if</span><span style="color:#000000;"> ([messageClass canSendText]) {</span>
//发送短信}else{
UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该设备没有发送短信的功能~" delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil]; [alterView show];}