Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
- picker.messageComposeDelegate = self;
- picker.recipients = [NSArray arrayWithObjects:@"1234", @"2345", nil];
- picker.body = yourTextField.text
- [self presentModalViewController:picker animated:YES];
- [picker release];
- #import <UIKit/UIKit.h>
- #import <MessageUI/MessageUI.h>
- @interface YourClass : UIViewController <MFMessageComposeViewControllerDelegate>
- {
- // ...
- NSString *sms = @"sms:+1234567890&body=This is sms body.";
- NSString *url = [sms stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
- static func sendMessageToNumber(number:String,message:String){
- let sms = "sms:(number)&body=(message)"
- let url = URL(string:sms)!
- let shared = UIApplication.shared
- if(shared.canOpenURL(url)){
- shared.openURL(url)
- }else{
- print("unable to send message")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement