UIActivityViewController freezes for the first time

When I call UIActivityViewController for the first time, the interaction is blocked. After the first click, this will be normal without blocking the interaction, does anyone know how not to catch the first time?

+6
source share
2 answers

Maybe this can help. I had a similar problem, the UIActivityViewController appeared rather slowly for the first time.

I decided to remove AirDrop from the supported activity types (via excludedActivityTypes ) and it became super fast. Therefore, if you are not interested in AirDrop (my case), you can do something like this:

 if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) { activityVC.excludedActivityTypes = @[UIActivityTypeAirDrop]; } 

Please note that UIActivityTypeAirDrop is only available with iOS 7.0.

+6
source

I really don't understand the problem - you assign / initialize the UIActivityViewController and then present it using presentViewController:animated:completion , right? Be sure to call presentViewController.. on the main thread. Sometimes UI elements caused by the wrong thread take seconds to execute. But it can also be just iOS - the UIActivityViewController takes some time to check the available services and stuff, which may be what slows it down.

-2
source

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


All Articles