Cannot dismiss email sheet invoked from UIDocument

2019-03-29 05:31发布

问题:

I've got a very simple test app which contains nothing but the following code, attached to a UIButton:

- (IBAction)buttonUp:(id)sender {

  // Build file path
  NSString* filePath = [[NSBundle mainBundle] pathForResource:@"testfile"
                                                       ofType:@"txt"];

  NSURL *url = [NSURL fileURLWithPath:filePath];

  m_interactionController = [UIDocumentInteractionController interactionControllerWithURL:url];

  [m_interactionController presentOptionsMenuFromRect:CGRectMake(200, 200, 100, 100)
                                               inView:[self view]
                                             animated:YES];
}

This builds with no issues, and running under iOS 7 (on a 4th generation iPad: A1458), this code works fine.

The problem is that, in iOS 8 Beta 5, if the user selects "Mail" from the UIDocumentInteractionController, then the email sheet that is displayed can never be dismissed. Tapping Send does indeed send the mail, but the email sheet continues to be displayed. Tapping on Cancel and electing to either delete or save the draft has no effect.

The problem occurs when the test app is built using Xcode 5.1.1. However, if the app is built with the Xcode 6 GM, then problem does not occur, and the code works fine.

Is there anything wrong with the code above?

回答1:

For us, the problem did not occur in the final released version of iOS 8.

I had posted it to Radar, and it was closed as a duplicate (with the status of the duplicate being "Open"), so presumably it was a bug in the prerelease versions of iOS 8.