iOS发送信息功能(生成信息内容)

//先判断是否支持信息发送
+(BOOL) canSmsWithText
{
    BOOL isTrue = NO;
    NSString *model=[[NSString alloc]initWithString:[Device machineName]];
    
    if( [model rangeOfString:@"iPhone"].location != NSNotFound)
    {
        isTrue = YES;
    }
    return isTrue;
}
//发送信息,调用系统类库
if ([Device canSmsWithText]==YES)
            {
                Class smsClass = (NSClassFromString(@"MFMessageComposeViewController"));
                if (smsClass != nil && [MFMessageComposeViewController canSendText]) {
                    MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
                    controller.title = @"短信房源";
                    controller.body = HouseInfo;
                    controller.recipients = nil;
                    controller.messageComposeDelegate = self;
                    [self presentViewController:controller animated:YES completion:nil];
                }
            }
            else
            {
                [ProgressHUD showError:@"不支持信息发送!"];
            }

 

posted on 2015-10-10 10:19  Baymax01  阅读(246)  评论(0编辑  收藏  举报

导航