嗨,我正在使用下面的代码将屏幕截图附加到 mailcomposer,我没有要检查的设备,所以这可以在实际设备上使用吗?
-(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:xyz@abc.com?cc=@\"\"&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]];
}