'프로그래밍/아이폰 / iOS'에 해당하는 글 1건

[Method 1]

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; 
pasteboard.persistent = YES;
pasteboard.image = [UIImage imageNamed:@"PDF_File.png"];

NSString *phoneToCall = @"sms:";
NSString *phoneToCallEncoded = [phoneToCall stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL *url = [[NSURL alloc] initWithString:phoneToCallEncoded];
[[UIApplication sharedApplication] openURL:url];    

if([MFMessageComposeViewController canSendText]) {
    NSMutableString *emailBody = [[NSMutableString alloc] initWithString:@"Your Email Body"];
    picker.messageComposeDelegate = self;
    picker.recipients = [NSArray arrayWithObject:@"123456789"];
    [picker setBody:emailBody];// your recipient number or self for testing
    picker.body = emailBody;
    NSLog(@"Picker -- %@",picker.body);
    [self presentModalViewController:picker animated:YES];
    NSLog(@"SMS fired");
}


[Method 2]

MFMessageComposeViewController* composer = [[MFMessageComposeViewController alloc] init];
composer.messageComposeDelegate = self;
[composer setSubject:@"My Subject"];

// These checks basically make sure it's an MMS capable device with iOS7
if([MFMessageComposeViewController respondsToSelector:@selector(canSendAttachments)] && [MFMessageComposeViewController canSendAttachments])
{
    NSData* attachment = UIImageJPEGRepresentation(myImage, 1.0);

    NSString* uti = (NSString*)kUTTypeMessage;
    [composer addAttachmentData:attachment typeIdentifier:uti filename:@"filename.jpg"];
}

[self presentViewController:composer animated:YES completion:nil];


It is possible to use from iOS7.

저작자 표시 비영리 변경 금지
신고

'프로그래밍 > 아이폰 / iOS' 카테고리의 다른 글

[iOS] How to send MMS from iPhone app?  (0) 2015.12.02

WRITTEN BY
빅터크룸
머 먹고 사냐.....

받은 트랙백이 없고 , 댓글이 없습니다.
secret