viniciusmo
viniciusmo

Reputation: 984

UIActivityViewController freeze in first time

When I call the first time UIActivityViewController, the interaction is locked. After the first click it will be normal without locking interaction, does anyone know how to not catch the first time?

Upvotes: 9

Views: 2456

Answers (2)

Fmessina
Fmessina

Reputation: 3771

Maybe this can help. I had a similar issue, UIActivityViewController was pretty slow to appear the first time.

I solved it removing AirDrop from the supported activity types (through excludedActivityTypes) and it became super fast. So 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];
}

Note that UIActivityTypeAirDrop is only available starting from iOS 7.0.

Upvotes: 7

czechboy
czechboy

Reputation: 944

I don't really understand the problem - you alloc/init a UIActivityViewController and then you present it with presentViewController:animated:completion, correct? Make sure to call the presentViewController... on the main thread. Sometimes UI stuff called on the wrong thread takes seconds to get executed. But it might also just be iOS - UIActivityViewController takes some time to check for available services and stuff, that might be the thing that's slowing it down too.

Upvotes: -2

Related Questions