Guest User

Untitled

a guest
Jul 21st, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. mailComposer = [[MFMailComposeViewController alloc] init];
  2.  
  3. mailComposer.mailComposeDelegate = self;
  4.  
  5. [mailComposer setSubject:@"Hlásenie poistnej udalosti"];
  6.  
  7. NSString * userMail = [userData objectForKey:@"E-mail"];
  8.  
  9. NSArray * toArray = [[[NSArray alloc] initWithObjects:to, nil] autorelease];
  10. NSArray * ccArray = [[[NSArray alloc] initWithObjects:userMail, nil] autorelease];
  11.  
  12. [mailComposer setToRecipients:toArray];
  13.  
  14. if(userMail != nil)
  15. [mailComposer setCcRecipients:ccArray];
  16.  
  17. NSError *tmpError = nil;
  18.  
  19. pdfData = [[NSData alloc] initWithContentsOfFile:thePath options:NSDataReadingUncached error:&tmpError];
  20.  
  21. if (tmpError) {
  22. NSLog(@"error: %@", [tmpError localizedDescription]);
  23. }
  24.  
  25. [mailComposer addAttachmentData:pdfData mimeType:@"application/pdf" fileName:@"report.pdf"];
  26.  
  27. NSMutableArray * photosPaths = [app getAllPhotosPaths];
  28.  
  29. int counter = 0;
  30. for(id item in photosPaths){
  31. counter++;
  32.  
  33. NSString * photoPath = (NSString *)item;
  34. NSData * photoData = [NSData dataWithContentsOfFile:photoPath];
  35.  
  36. photoData = [NSData dataWithContentsOfFile:photoPath];
  37.  
  38. [mailComposer addAttachmentData:photoData mimeType:@"image/jpg" fileName:[NSString stringWithFormat:@"Fotografia %d.jpg", counter]];
  39. }
  40.  
  41. NSString * emailBody = @"Hello";
  42.  
  43. [mailComposer setMessageBody:emailBody isHTML:YES];
Add Comment
Please, Sign In to add comment