Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

iphone - Meaning of Warning "while a presentation is in progress!"

When I am integarting the Instagram in my project. I am getting a image from UIImagePickerController and after it i want to send it to Instagram But when I am sending image to Instagram by UIDocumentInteractionController delegate method presentOptionsMenuFromRect:inView: animated: like this

[documentInteractionController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];

The warning comes Warning: Attempt to present <_UIDocumentActivityViewController: 0x7584780> on while a presentation is in progress!
The application is not Crashing. But I am not getting the Problem. Why this warning comes and what It means. I searched on Internet and read questions about this but not got any answer. Help me !!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
// Breaks
[viewController1 dismissViewControllerAnimated:YES completion:NULL];
[self presentViewController:viewController2 animated:YES completion:NULL];

// Does not break
[viewController1 dismissViewControllerAnimated:YES completion:^{
    [self presentViewController:viewController2 animated:YES completion:NULL];
}];

The Swift 3 version of the above code would look like this:

// Breaks
viewController1.dismiss(animated: true)
present(viewController2, animated: true)

// Does not break
viewController1.dismiss(animated: true) {
    present(viewController2, animated: true)
}

Note the use of the completion handler in the second example above.
It only presents viewController2 after viewController1 has been fully dismissed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...