开发者

how to attatch a file to the mail using default mail composer

开发者 https://www.devze.com 2023-01-20 16:26 出处:网络
i hav a file with some data and i want to attach this file to mail, and i am using the default mail composer ...

i hav a file with some data and i want to attach this file to mail, and i am using the default mail composer ...

any idea how to attach the file to mail before sending to receip开发者_运维百科ents....

Thanks in advance....


Example with an attached image:

NSData *myData = UIImagePNGRepresentation(myImage);
[mailComposer addAttachmentData:myData mimeType:@"image/png" fileName:@"MyImage"];


NSString *path = [[NSBundle mainBundle] pathForResource:@"bg" ofType:@"jpg"];

NSData *myData = [NSData dataWithContentsOfFile:path];

[controller addAttachmentData:myData mimeType:@"image/jpg" fileName:@"Attachment-1"];
[self presentModalViewController:controller animated:YES];
0

精彩评论

暂无评论...
验证码 换一张
取 消