- (IBAction)button_number1:(id)sender {
MFMessageComposeViewController *textComposer = [[MFMessageComposeViewController alloc] init];
[textComposer setMessageComposeDelegate:self];
if ([MFMessageComposeViewController canSendText]) {
[textComposer setRecipients:@[string_numberphone]];
[textComposer setBody:@"ABC"];
[self presentViewController:textComposer animated:YES completion:NULL];
} else {
NSLog(@"Can't Open Text");
}
}
}
当我单击 button_number1 时,它不起作用,并且没有 arlet 错误。
但是当单击下面的按钮时,它在 iOS 7 上正常工作,但我无法分配消息内容。请指导我如何将消息内容分配给此 button_number2。
- (IBAction)button_number2:(id)sender {
NSString *message = [[NSString alloc] initWithFormat:@"sms:%@",string_numberphone];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:message ]];
}
非常感谢!