iOS application-Objective C | Bool of completion handler not working properly

Copper Contributor

I am using outlook in iOS application. From my app I am sending email after giving Subject, email Body & Attachment.

 

Till iOS14 everything was fine. But from iOS15 we are getting Completed bool as NO all the time even if after sending the email.

 

Below is my codebase:

 

  1. Preparing outlook email data while opening Activity controller.

NSArray *items = [NSArray arrayWithObjects:str_Receipent, str_EmailSubject, sFileName, str_EmailBody,fileURL,nil];

        PMIiSMSPopoverPresentationController *popOverMail;

        UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];

        popOverMail = [[PMIiSMSPopoverPresentationController alloc] initWithContentViewController:activityVC];

        popOverMail.delegate = self;

        popOverMail.popoverContentSize = CGSizeMake(300, 344);

        

        [popOverMail presentModalPopoverFromRect:CGRectMake(700,45,1, 1) object:self  inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

 

  1. Completion handler block

[activityVC setCompletionWithItemsHandler:

         ^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {

            if (completed) {

                NSLog(@"mail sent");

                [popOverMail dismissPopoverAnimated:YES];

 

            }

            else if((!completed)){

                NSLog(@"Fail To Mail send");

            }

 

        }];

 

Here always we are getting NO in Completed Bool even after send email successfully or cancelling the outlook email window. That’s why we are not able to decide for the next action.

 

Please let me know if I am missing anything or did anything wrong and need to improve.

Thanks for your help in advance.

0 Replies