My application is to create a csv file and send it by mail. But when I drop the mail, I get a black screen. The previous view is not displayed and is covered with a black screen. I looked at various questions and answers in the stack overflow. But nothing works.
- (IBAction)openMail:(id)sender { [self getdata]; if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; mailer.mailComposeDelegate = self; [mailer setSubject:@"BMNET- Travel Log"]; NSString * CSVstring=@ "Name, StartingDateNTime, EndingDateNTime, TravelType, DistanceTravelled, Amount\n" ; NSString *CSVPath,*record;; NSString *temporayCSV= @"" ; for (int i=0; i<[getAmount count]; i++) { record = [NSString stringWithFormat:@"%@, %@, %@, %@, %@, %@", [getName objectAtIndex:i], [getStartDate objectAtIndex:i], [getEndDate objectAtIndex:i],[getType objectAtIndex:i],[getDistance objectAtIndex:i],[getAmount objectAtIndex:i]]; NSLog(@"%d",i); temporayCSV = [NSString stringWithFormat:@"%d %@ \n ",(i+1),record]; CSVstring = [CSVstring stringByAppendingFormat:temporayCSV]; NSLog(@"%@",CSVstring); } NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSArray *toRecipients = [NSArray arrayWithObjects:@"", nil]; [mailer setToRecipients:toRecipients]; CSVPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.csv", @"CSV_FormatedTable"]]; NSFileManager *fileManager;
source share