Privacy issues with MFMailComposeViewController and only iOS 10

Recovering an already published application with Xcode 8.0 that uses PLCrashReporter, AWS Cognito / SNS, and Google Analytics.

Seeing that only on iOS 10.x devices, during the launch of my test bucket, the letter creating vc is no longer displayed. In the Xcode console, I see these messages immediately when it is reached ([MFMailComposeViewController.canSendMail]):

[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles [MC] Filtering mail sheet accounts for bundle ID: [MY BUNDLE ID], source account management: 1 [MC] Result: YES 

I found one link to similar console messages here: UIActivityViewController crash on iOS 10

But my application does not use photos, but I tried to add a description of the privacy of photos specified in the link to my info.plist for smiles, but, of course, no joy. The problem persists.

My application really uses the camera to scan barcodes. And a description of the privacy of the camera is in info.plist and from last year. The app does not use any other features that require privacy descriptions.

The exact exact code and setting of the XC8 when connecting the device iOS 9.3.5 work properly.

Has anyone else seen this?

+5
source share
3 answers

So after a lot of analysis, I finally solved this problem last weekend. The key to understanding this, in fact, had nothing to do with changing the privacy of MFMailComposeViewController in iOS 10, this log message was:

 [MC] Result: YES 

If you get NO, then you have a privacy problem, but YES indicates that privacy is not a problem. Finally, I found in my case that the problem was that the problem was in my code that was discovered in iOS 10.

In the same device model being tested, with iOS 10 and iOS 9.3.5, the problem was that the UIAlertController call request was called when another warning was already presented. On iOS 9.x and earlier, it was just “luck” that the expected one won and received the first time each time. But on iOS 10, he did not do this every time, and then blocked the MFMailComposeViewController in my situation.

The following code was problematic:

 [self presentViewController:crashMailAlertController animated:YES completion:nil]; 

Replacing it with this code resolved the problem:

 [self dismissViewControllerAnimated:YES completion:^{ [self presentViewController:crashMailAlertController animated:YES completion:nil]; }]; 

In my case, all I wanted was to ensure that this error path of the UIAlertController was always presented first, as it was a rare event (only when the failure occurred), so rejecting any previous warning was first a ticket to receive it that MFMailComposeViewController will follow as it was built into the action of the alert button.

+1
source

I got one log message when I tried to open the Shared Activities dialog (using the UIActivityViewController). The code worked fine in ios9, but it didn’t work in ios10 (instead of a dialog, I only got 2 pop-ups with "More ..."). I was passing one image in an array like "activityItems: [myImage]". It seems that the problem was that this argument expects an array of optional values, so switching to "[myImage!]" Solved the problem.

Not sure if this is the solution to the problem described, but maybe something like this will work.

0
source

His work is for me!

 if([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailCont = [[MFMailComposeViewController alloc] init]; mailCont.mailComposeDelegate = self; // Required to invoke mailComposeController when send [mailCont setSubject:@"Mail Subject"]; [mailCont setToRecipients:[NSArray arrayWithObject:@" demo@gmail.com "]]; [mailCont setMessageBody:@"" isHTML:NO]; [self presentViewController:mailCont animated:YES completion:nil]; } 
0
source

Source: https://habr.com/ru/post/1257620/


All Articles