안녕하세요 아래 코드를 사용하여 메일 콤포넌트에 스크린 샷을 첨부하고 있습니다. 실제 장치에서이 작업을 확인할 수있는 장치가 없습니까?iOS의 메일 콤포넌트에 스크린 샷을 첨부하는 방법
-(void)launchMailAppOnDevice
{
/*Take a SnapShot of current screen*/
UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData * imageData = UIImageJPEGRepresentation(image, 1.0);
NSString *recipients = @"mailto:[email protected][email protected]\"\"&subject=blah!!blah!!";
NSString *body = @"&body=blah!!blah!!";
NSString *email = [NSString stringWithFormat:@"%@%@%@", recipients, body, imageData];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}
"mailto"는 어디에서 사용하셨습니까? 왜'MFMailComposeViewController'를 사용하고'addAttachmentData : mimeType : fileName :'을 사용하여 스크린 샷을 첨부 파일로 추가할까요? –
이것이 실제로 작동하는지 보려면 관심이 있습니다 ... 사용하지 않았지만 재미있는 방법입니다. – Dustin